How to give ADO.NET Parameters

前端 未结 4 1472
陌清茗
陌清茗 2020-11-30 13:38

I want to create a SQL command that adds record to DB. I tried the following code but it doesn\'t seem to be working:

SqlCommand comand = new SqlCommand(\"IN         


        
4条回答
  •  醉酒成梦
    2020-11-30 13:55

    I think this is useful for u

    SqlCommand command = new SqlCommand("inserting", con);
    command.CommandType = CommandType.StoredProcedure;
    command.Parameters.Add("@Firstname", SqlDbType.NVarChar).Value = TextBox1.Text;
    command.Parameters.Add("@Lastname", SqlDbType.NVarChar).Value = TextBox2.Text;
    command.ExecuteNonQuery();
    

提交回复
热议问题