Last post Dec 14, 2019 02:42 PM by mariolopes
Member
423 Points
970 Posts
Dec 14, 2019 02:31 PM|mariolopes|LINK
Hi
Please look at this piece of code:
SqlDataSource3.SelectParameters.Clear(); SqlDataSource3.SelectCommand = "select IFNULL(max(id) as maior,1) from correspondencia"; SqlDataSource3.DataBind(); DataView dvsqllist = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); System.Data.DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty); DataTable tablelist = dvsqllist.Table; Response.Write(tablelist.Rows[0]["maior"].ToString());
Why I got error (not record at postion 0)
Thank you
Dec 14, 2019 02:42 PM|mariolopes|LINK
Sorry, The code is wrong
There is the correct code
string maior=""; SqlDataSource3.SelectParameters.Clear(); SqlDataSource3.SelectCommand = "select IFNULL(max(id),1) as maior from correspondencia"; SqlDataSource3.DataBind(); DataView dvsqllist = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty); DataTable tablelist = dvsqllist.Table; SqlDataSource3.DataBind(); foreach (DataRow row in tablelist.Rows) { maior = row["maior"].ToString(); }
Member
423 Points
970 Posts
Why does not return 1 -
Dec 14, 2019 02:31 PM|mariolopes|LINK
Hi
Please look at this piece of code:
Why I got error (not record at postion 0)
Thank you
https://programamos.pt
Member
423 Points
970 Posts
Re: Why does not return 1 -
Dec 14, 2019 02:42 PM|mariolopes|LINK
Sorry, The code is wrong
There is the correct code
https://programamos.pt