私は、ワンクリックで複数のアイテムを追加できる在庫システムを作成しています。どうすればいい?私はすでにデータを保存することができますが、ただ一つのテキストボックスです。データベースの1列に複数のテキストボックスを追加する
//Add new Data if Item Code is not exit;
{
OleDbCommand cmdInsert = new OleDbCommand(@"insert into TblInventory (ItemCode,ProductName,Quantity,DateAndTime) values ('" + txtItem.Text + "','" + txtProduct.Text + "','" + txtQuantity.Text + "','" + time + "')");
cmdInsert.Connection = con;
cmdInsert.ExecuteNonQuery();
MessageBox.Show("You added New " + txtQuantity.Text + " " + txtProduct.Text + " in the list", "New Item");
}
con.Close();
IはtxtItem2
、txtProduct2
とtxtQuantity2
である別のテキストボックスを持っていると仮定します。 insert into statement
にはどこにあるのですか?以下のような代わりに、文字列の連結の
さらに別のSQLインジェクション:パラメータについては、最初にお読みください:https://msdn.microsoft.com/en-us/library/system.data.oledb.oledbparameter –
それから質問に詳しい説明をしてください:P – ThatAwesomeCoder
@ThatAwesomeCoder先ほどご紹介してください質問 –