hi ,
try this one
using (SqlConnection con = new SqlConnection(conString))
{
con.Open();
using (cmd = new SqlCommand("SP_DMS", con))
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand(@"INSERT INTO [dbo].[main] ([first], [second], [third], [fourth], [fifth], [sixth]) VALUES (@first, @second, @third, @fourth, @fifth, @sixth)", con);
komanda.Parameters.AddWithValue("@first", ..................);
komanda.Parameters.AddWithValue("@second", ..............);
komanda.Parameters.AddWithValue("@third", .................);
komanda.Parameters.AddWithValue("@fourth", ...............);
komanda.Parameters.AddWithValue("@fifth", ..................);
komanda.Parameters.AddWithValue("@sixth", .................);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
Session["notice"] = "Success...:";
Response.Redirect("Default.aspx");
// Response.Write("ConnectionStatus:" + con.State.ToString());
ViewState["HeadId"] = Convert.ToString(cmd.ExecuteScalar());
}
}
Time is Gold
Thanks & Regards,
Rajesh Kumar,
9962038582.
Nandakishore, if this helps please login to Mark As Answer. | Alert Moderator