executenonquery() Syntax Error

I'm getting a "Syntax error converting datetime from character to string".
The returned error says it is located on this line of code: cmd.executenonquery()

Please see code below. All and any help is greatly appreciated. Thanks!
Public Sub btnSubmit_Click (byval s as object, byval e as system.eventargs)
	Dim con as sqlConnection
	dim cmd as sqlcommand
	Dim dtr as Sqldatareader
	Dim str as string
	Dim strAccount as string
	dim BreakTestID as integer
	con = new sqlconnection ("Server=sqlserver;UID=sa;PWD=#####;Database=BreakTest")
	str = "INSERT tblBreakTest (BreakTestNO, InstallDate, CustomerNO, LoginID,BreaktestDate,Division,Application, TypeofService, Comments, Location, ProdDesc, NoofLines, ProductNO, ReturnReason, Status, SplicerName, SplicerRegion, SplicerCountry, SplicerPhone, SplicerPostalCode, SplicerState) VALUES "
	str = str & "(@BreakTestNo, @InstallDate, @Customer, @Login, @BreakTestDate, @Division, @Application, @TypeofService, @Comments, @Location, @ProdDesc, @NoofLines, @Product, @ReturnReason, @Status, @SplicerName, @Region, @Country, @SplicerPhone, @PostalCode, @State )"
	cmd = New sqlcommand (str, con)
	cmd.parameters.add ("@BreakTestNo", lblBreakTestID.Text)
	cmd.parameters.add ("@InstallDate", txtinstallDate.text)
	cmd.parameters.add ("@Customer", lblCompanyNo.text)
	cmd.parameters.add ("@Login", label2.text)
	cmd.parameters.add ("@BreakTestDate", txtDate.text)
	cmd.parameters.add ("@Division", cboDivision.text)
	cmd.parameters.add ("@Application", cboApplication.text)
	cmd.parameters.add ("@TypeofService", cboService.text)
	cmd.parameters.add ("@Comments", txtComments.text)
	cmd.parameters.add ("@Location", cboLocation.text)
	cmd.parameters.add ("@ProdDesc", txtProdDesc.text)
	cmd.parameters.add ("@NoofLines", txtNoLines.text)
	cmd.parameters.add ("@Product", txtProductNo.text)
	cmd.parameters.add ("@ReturnReason", cboReturnReason.text)
	cmd.parameters.add ("@SplicerName", txtSplicerName.text)
	cmd.parameters.add ("@Region", txtRegion.text)
	cmd.parameters.add ("@Country", txtCountry.text)
	cmd.parameters.add ("@SplicerPhone", txtPhoneNumber.text)
	cmd.parameters.add ("@PostalCode", txtPostalCode.text)
	cmd.parameters.add ("@State", txtState.text)
	strAccount = request.cookies("AccountCookie").value
	Select Case strAccount
	Case "Regional Sales Manager"
		cmd.parameters.add ("@Status", "Pending-GSM Approval")
	Case "General Sales Manager"
		cmd.parameters.add ("@Status","Pending-Technical Manager Approval")
	Case "R & D Personnel"
		cmd.parameters.add ("@Status", "Approved-Pending Receipt of Rope")
	Case Else
		cmd.parameters.add("@Status", "Initiated")
	End Select

Open in new window

Who is Participating?
timexistConnect With a Mentor Commented:
you need to check this txtinstallDate.text first.
before you pass this string in, you should put an validation on this field.
something likes a mask.
All Input Data Is Evil.
error is from this:
cmd.parameters.add ("@InstallDate", txtinstallDate.text)
try to change to this:
cmd.parameters.add ("@InstallDate",Cdate(txtinstallDate.text))

Of course you need to user's input first.
dhaverstrawAuthor Commented:
Changed the code. User now recieves this error: Conversion from string "tbd" to type 'Date' is not valid.
Error is on cmd.parameters.add ("@InstallDate", Cdate(txtinstallDate.text))
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Kumaraswamy RConnect With a Mentor Commented:

try to change like this:
if (txtinstallDate.text != "")
 cmd.parameters.add ("@InstallDate",Cdate(txtinstallDate.text))
 cmd.parameters.add ("@InstallDate",datetime.minvalue)
Gururaj BadamCommented:
In the simplest terms how many date columns does the table contain and what are the values you're passing through the command?

InstallDate as taken as text parameter insted of date time convert it into date time using cDate and eecute your application
All Courses

From novice to tech pro — start learning today.