Click here to Skip to main content
15,906,766 members

Comments by manish7664 (Top 49 by date)

manish7664 15-Feb-18 9:55am View    
thnx F-ES
manish7664 4-Feb-18 9:20am View    
its working in parameter query ..
thnx OriginalGriff..
manish7664 11-Apr-14 13:37pm View    
Thanks Mr. Bernhard for reply. i have modified my code as per your suggestion but when i click on save button then one error coming.
Error ---> Object reference not set to an instance of an object.
Error line ---> command.CommandText = "SELECT @@IDENTITY As myInsertID";
manish7664 11-Apr-14 1:50am View    
datatype of id is int.
manish7664 9-Apr-14 7:27am View    
sorry sir but i want c# code.
MessageBox.Show("Your ID No. is- ");

private void Save_Click(object sender, EventArgs e)
{
conn = new SqlConnection(@"Data Source..........");
conn.Open();
SqlCommand command = new SqlCommand();
command.CommandText = "insert into test(name)values('" + textBox2.Text + "'")";
command.Connection = conn;
command.ExecuteNonQuery();
MessageBox.Show("Your ID No. is- ");
}