FUNCTION CustomerAdd(tcName, tcEmail, tcPassword) INSERT INTO Customers ; (cName, ; cEmail, ; cPassword) ; VALUES ; (tcName, ; tcEmail, ; tcPassword) RETURN CustomerID ENDFUNCand here's my VB.Net code:
Public Function AddCustomer(ByVal tcName As String, ByVal tcEmail As String, ByVal tcPassword As String) As Integer Dim loConnection As OleDbConnection Dim loCommand As OleDbCommand Dim loCustID As OleDbParameter Dim lcConnectString As String Dim liCustomerID As Integer lcConnectString = "Provider=vfpoledb;Data Source=" & Server.MapPath(".") & "\Data\ss.dbc;Nulls=1" loConnection = New OleDbConnection(lcConnectString) loConnection.Open() loCommand = New OleDbCommand() loCommand.Connection = loConnection loCommand.CommandText = "SET NULL OFF\r\nSET DELETED ON" loCommand.ExecuteNonQuery() loCommand = New OleDbCommand() loCommand.Connection = loConnection loCommand.CommandText = "CustomerAdd" loCommand.CommandType = CommandType.StoredProcedure loCustID = New OleDbParameter() loCustID = loCommand.Parameters.Add("CustomerID", OleDbType.Integer) loCustID.Direction = ParameterDirection.ReturnValue loCommand.Parameters.Add("Name", OleDbType.Char) loCommand.Parameters.Add("Email", OleDbType.Char) loCommand.Parameters.Add("Password", OleDbType.Char) loCommand.Parameters("Name").Value = tcName loCommand.Parameters("Email").Value = tcEmail loCommand.Parameters("Password").Value = tcPassword loCommand.ExecuteNonQuery() loConnection.Close() liCustomerID = CInt(loCustID.Value) Return liCustomerID End FunctionI'm getting an error on the ExecuteNonQuery() line:
System.Data.OleDb.OleDbException: Variable 'Q5P0' is not found.Oddly, the integer after the 'Q' increments every time I run the code.