A problem i am having is that i need to enter a value for the Hardware_Problem_Id which is set to autonumber in the access database. Am i right in thinking that you use null?
Also could anyone tell me how you would include a time and date stamp in the string, here is my attempt so far
SQLStr4 = "INSERT INTO Hardware_Problems (Hardware_Problem_Id, Hardware_Id, Date_Reported, Time_Reported, Staff_Reported, Problem_Description, Location, Resolve_Flag) VALUES (NULL, @Hardware_Id, '10/02/2006', '10:21', @Staff_Reported, @Problem_Description, @Location, 'Yes')"
Dim sqlCommand AsNew System.Data.OleDb.OleDbCommand
sqlCommand.Connection = DBCon
sqlCommand.CommandText = SQLStr4
sqlCommand.Parameters.Add("@Hardware_Id", SqlDbType.VarChar).Value = HardwareId
sqlCommand.Parameters.Add("@Staff_Reported", SqlDbType.VarChar).Value = Staff
sqlCommand.Parameters.Add("@Problem_Description", SqlDbType.VarChar).Value = Description
sqlCommand.Parameters.Add("@Location", SqlDbType.VarChar).Value = Location
I keep on getting the error: Error reading database, No value given for one or more required parameters
thanks again
john
Also could anyone tell me how you would include a time and date stamp in the string, here is my attempt so far
SQLStr4 = "INSERT INTO Hardware_Problems (Hardware_Problem_Id, Hardware_Id, Date_Reported, Time_Reported, Staff_Reported, Problem_Description, Location, Resolve_Flag) VALUES (NULL, @Hardware_Id, '10/02/2006', '10:21', @Staff_Reported, @Problem_Description, @Location, 'Yes')"
Dim sqlCommand AsNew System.Data.OleDb.OleDbCommand
sqlCommand.Connection = DBCon
sqlCommand.CommandText = SQLStr4
sqlCommand.Parameters.Add("@Hardware_Id", SqlDbType.VarChar).Value = HardwareId
sqlCommand.Parameters.Add("@Staff_Reported", SqlDbType.VarChar).Value = Staff
sqlCommand.Parameters.Add("@Problem_Description", SqlDbType.VarChar).Value = Description
sqlCommand.Parameters.Add("@Location", SqlDbType.VarChar).Value = Location
I keep on getting the error: Error reading database, No value given for one or more required parameters
thanks again
john