using (SqlConnection connection = new SqlConnection(DataHelper.ConnectionString))
{
using (SqlDataAdapter Adapter = new SqlDataAdapter())
{
try
{
Adapter.InsertCommand.Connection.Open();
Adapter.InsertCommand = new SqlCommand("Sample", connection);
Adapter.InsertCommand.CommandType = CommandType.StoredProcedure;
Adapter.InsertCommand.Parameters.AddWithValue("@reqno", "emid");
Adapter.InsertCommand.Parameters.AddWithValue("@vouno", "emname");
Adapter.InsertCommand.ExecuteNonQuery();
}
catch (Exception aa)
{
MessageBox.Show("x " + aa);
}
[B] Adapter.InsertCommand.Connection.Close();[/B] // It Shows error in here
}
Faz88
0
Newbie Poster
Knvn
14
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.