private void Order()
{
using (SqlConnection connection = new SqlConnection(connectionString1))
{
String query = "INSERT INTO Tbl_order (OrderName,Quantity,Price,Serves_way,Date,CustomerNo) VALUES (@OrderName,@Quantity, @Price,'" + servers + "','" + time1.ToString(format1) + "','" + Globals.order + "' )";
Globals.order++;
connection.Open();
using (SqlCommand command = new SqlCommand(query, connection))
{
// Add the length of this text column as third parameter...
command.Parameters.Add("OrderName", SqlDbType.NVarChar, 50);
command.Parameters.Add("Quantity", SqlDbType.Int);
command.Parameters.Add("Price", SqlDbType.Money);
command.Prepare();
for (int i = 0; i < lst_OrderName.Items.Count; i++)
{
command.Parameters[0].Value = lst_OrderName.GetItemText(lst_OrderName.Items[i]);
command.Parameters[1].Value = Convert.ToInt32(lst_QTY.Items[i]);
command.Parameters[2].Value = Convert.ToDouble(lst_Price2.Items[i]);
command.ExecuteNonQuery();
/* int totalRows = CustomerNo.Rows.Count;
int totalCols = CustomerNo.Columns.Count;
string value = CustomerNo.Rows[totalRows - 1][totalCols - 1].ToString();*/
}
}
}
}
有人可以解释我错在哪里吗? 我想在页面中添加滑块。我用过短码操作符。上面的代码来自我的custompost文件。我检查了所有的css和js是否正确加载。但仍然无法获得输出。有人能帮我吗。提前致谢