你们必须确定参数值(有问题标记的数值)。 在VB中就是一个类似的例子。 NET:
Make a Command f或 this connection
and this transaction.
Dim cmd As New OleDb.OleDbCommand( _
"SELECT * FROM People WHERE FirstName=? AND " & _
"LastName=?", _
connUsers)
Create parameters f或 the query.
cmd.Parameters.Add(New _
OleDb.OleDbParameter("FirstName", first_name))
cmd.Parameters.Add(New OleDb.OleDbParameter("LastName", _
last_name))
如果你不希望使用参数提问,那么仅用缺省值或价值变量来替代问题标记:
string updateIncomeData = @"INSERT INTO TEAM_FUNDS_DETAILS("
+ "COMPONENT_TYPE,COMPONENT_NAME,COMPONENT_AMOUNT, YEAR_FOR, MONTH_FOR)"
+ "VALUES(" + Convert.ToInt32(TeamFundDetailsEnumClass.ComponentType.Income)
+ " , , 0,"
+ ddlYear.SelectedIndex + ", " + ddlMonth.SelectedIndex + ")"
或
string updateIncomeData = @"INSERT INTO TEAM_FUNDS_DETAILS("
+ "COMPONENT_TYPE,COMPONENT_NAME,COMPONENT_AMOUNT, YEAR_FOR, MONTH_FOR)"
+ "VALUES(" + Convert.ToInt32(TeamFundDetailsEnumClass.ComponentType.Income)
+ " , " + myComponentName + " , " + myComponentAmount,"
+ ddlYear.SelectedIndex + ", " + ddlMonth.SelectedIndex + ")"