下面的新更新
当我运行 insertSQL() 时我的插入语句没有执行我 不确定我是否正确传递了参数。在我的研究中,我看到 SQL 命令被广泛用于传递参数,但这是我应该这样做的方式。
这是我更新的代码:FORM frmProcessLayout -->
public void insertSQL( string processName, string processingLevel, string department, string formName)
{
string[] parameters = new string[4];
sSql = "INSERT INTO [ServiceStation].[dbo].[ProcessLayout] ([ProcessName], [ProcessingLevel], [Department], [FormName]) VALUES(@Parameter[0], @Parameter[1], @Parameter[2], @Parameter[3])";
parameters[0] = processName;
parameters[1] = processingLevel;
parameters[2] = department;
parameters[3] = formName;
ssDBAccess.DBAccess oDb = new ssDBAccess.DBAccess();
oDb.SetConnection();
oDb.ExecuteNonSelectSQL(sSql, parameters);
}
这就是我所看到的作为我应该做的参考,但它在 Visual Basic 中
Function addRow(ByVal fax As String, ByVal scan As String, ByVal backup As String)
Dim parameters(2) As String
Addrow = Nothing
ssql = "INSERT INTO [ServiceStation].[dbo].[OnBaseSweepFaxPath] ([FaxLine],[FaxSweepPath] ,[FaxBackupPath])"
ssql += "VALUES(@Parameter0, @Parameter1, @Parameter2)"
parameters(0) = fax
parameters(1) = scan
parameters(2) = backup
odb.ExecuteNonSelectSQL(ssql, parameters)
End Function