If I execute the program from within Visual Studio, the program runs absolutely fine. Once I put the .exe from debug on a different computer, it gives a error of No Value Given for One or More required parameters.
I know that it could be that the parameters are incorrect, but I don't specifiy the column my data appends to when it's saved to the database. It just fills in each column across. Any help is appreciated!
ALSO! Even though this error pops up, I am still able to save to the database. But as this is for the company i work for, I don't want an error to come up at all. If any additional info is needed, just ask and I'll post! Thanks in advance!
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
'Check for Data in Design, Color, and Quality Text Box
If txtDesign.Text = String.Empty Then
MsgBox("Please Enter a Design Name!")
Exit Sub
End If
If txtColor.Text = String.Empty Then
MsgBox("Please Enter a Color Number!")
Exit Sub
End If
If txtQuality.Text = String.Empty Then
MsgBox("Please Enter a Quality!")
Exit Sub
End If
'Create Key for Use with Data Base
Dim design = txtDesign.Text
Dim color = txtColor.Text
Dim quality = txtQuality.Text
Dim design1 = design.Length / 2
Dim quality1 = design.Length / 2
Dim designKey = design.Substring(0, design1)
Dim qualityKey = quality.Substring(0, quality1)
Dim runDate As Date
runDate = Date.Now
Dim d As String = Format(runDate, "MMddyyyy")
Dim runKey = designKey + color + qualityKey + d
'Create Formatted Time for Time of Entry
Dim defectTime As Date
defectTime = TimeOfDay
'Append Data to the Data Grid View
logView.Rows.Add(New Object() _
{txtGradeCode.Text, txtColorGrade.Text, _
txtDefect.Text, defectTime, txtNotified.Text, txtInspector.Text, txtComment.Text, runKey})
Try
con = New OleDb.OleDbConnection
Dim strPath As String
strPath = Path.GetDirectoryName(Application.ExecutablePath)
con.ConnectionString = "PROVIDER = Microsoft.ACE.OLEDB.12.0; Data Source = C:\Users\God\QualityLog.accdb;"
Dim SQL As String
SQL = "INSERT INTO [Quality Log] VALUES ('" & runKey & "','" & txtGradeCode.Text & "', '" & txtColorGrade.Text & "', '" & txtDefect.Text & "', '" & defectTime & "', '" & txtNotified.Text & "', '" & txtInspector.Text & "', '" & txtComment.Text & "')"
cmd = New OleDb.OleDbCommand(SQL, con)
con.Open()
cmd.ExecuteNonQuery()
con.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
txtComment.Clear()
End Sub