Data is not inserting into table?

前端 未结 5 1093
轮回少年
轮回少年 2020-12-11 11:02

My table name is Customer. It has four columns

CustomerId
CustomerName
CustomerAddress
PhoneNo

This is my c# code. I am not ge

5条回答
  •  自闭症患者
    2020-12-11 11:36

    What you say simply doesn't happen. Either the query will insert a record, or you will get an exception.

    There is an error in your query, though. There shouldn't be apostrophes around the @CustAdd parameter, that will make the database interpret that as a literal string, not a parameter:

    string query = "insert into Customer(CustomerName,CustomerAddress,PhoneNo) values (@CustNm,@CustAdd,@Ph)";
    

    I'm not certain how the database would react, but you would either get an exception telling you that you have a parameter that is never used in the query, or it would insert a record with the value @CustAdd as the address.

提交回复
热议问题