con.Open();
dr = null;
SqlCommand cmd = new SqlCommand("SELECT @@IDENTITY", con);
dr = cmd.ExecuteReader();
while (dr.Read())
try
{
{
LBL.Text = (dr["ID"].ToString());
}
}
I have an error in the red line say
System.IndexOutOfRangeException: DeliveryID
I want to get the new database that just add in on to this page
System.IndexOutOfRangeException: DeliveryID
I want to get the new database that just add in on to this page
Tan Kai KaiPosted Jul 14, 2013, 9:13 AM
Iftikar HussainPosted Jul 13, 2013, 2:40 AM
read this article for calling stored procedure from your VS
http://stackoverflow.com/questions/7836766/calling-a-stored-procedure-with-asp-net
http://support.microsoft.com/kb/306574
Regards,
Iftikar
Tan Kai KaiPosted Jul 12, 2013, 11:31 AM
Tan Kai KaiPosted Jul 12, 2013, 10:57 AM
Plus I using SQL IN the VS so got other way
then how to take the id from here Response.Redirect("YourNextPage.aspx?Id=" + id.ToString());
Iftikar HussainPosted Jul 12, 2013, 10:35 AM
Then in your code do like this
cmd.CommandType=CommandType.StoredProcedure,
int id=Convert.ToIn32(cmd.ExecuteScalar());
use this id in next page as query string like
Response.Redirect("YourNextPage.aspx?Id=" + id.ToString());
Regards,
Iftikar
Tan Kai KaiPosted Jul 12, 2013, 10:17 AM
Iftikar HussainPosted Jul 12, 2013, 9:59 AM
Regards,
Iftikar
Tan Kai KaiPosted Jul 12, 2013, 9:44 AM
Riyaz AkhtarPosted Jul 12, 2013, 5:49 AM
Riyaz AkhtarPosted Jul 12, 2013, 5:45 AM
SqlCommand cmd = new SqlCommand("SELECT @@IDENTITY as ID", con);
Kunal VaishyaPosted Jul 12, 2013, 5:18 AM
VulpesPosted Jul 12, 2013, 5:12 AM
Iftikar HussainPosted Jul 12, 2013, 4:42 AM
Regards,
Iftikar
Tan Kai KaiPosted Jul 12, 2013, 4:30 AM
Iftikar HussainPosted Jul 11, 2013, 10:55 AM
You should try like this
con.Close();
if(data!=null)
Let me know if you need any more help.
Regards,
Iftikar