Can someone tell me what I am missing... I keep getting this error when trying to write to the database
Thank you!!!!!
Parameterized Query '(@WorkSheetID nvarchar(14),@Origin nvarchar(5),@DealerName nvarc' expects parameter @Address, which was not supplied.
[FONT=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif]Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Parameterized Query '(@WorkSheetID nvarchar(14),@Origin nvarchar(5),@DealerName nvarc' expects parameter @Address, which was not supplied.
Source Error:
Line 401: .Add(New SqlParameter("@DOB", sDOB))Line 402: End WithLine 403: ra = myCommand.ExecuteNonQuery()Line 404: myConnection.Close()Line 405: 'Lets Check to see if there is a Co Applicant
Here is my Code:
Dim ra As Integer
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim connString As String = "Server=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|CustomerInfo.mdf;Integrated Security=True;User Instance=True"
Dim CPhoneNum, CWorkNum, CCellNum, sWorkSheetNum, sSaleOrigin As String
Dim sDealerShipName, sBkupSlsRep, sDateCreated, sFirstName, sMiddleName, slastname, sBuyAddress, sSSN, sDOB As String
Dim scity, sState, sZip, sEmailAddres, sBuyersCounty, sSalesTax As String
Dim SlsManLoginN As String
Dim myPrincipal As IPrincipal = Me.User
'Customer Information
sWorkSheetNum = lblCustWksnum.Text
sSaleOrigin = lblSaleOrigin.Text
sDealerShipName = lblDealerShipName.Text
sDateCreated = lblDateCreated.Text
sBkupSlsRep = lblBkupSlsRep.Text
sFirstName = lblcFirstName.Text
sMiddleName = lblcMiddleName.Text
slastname = lblcLastName.Text
sBuyAddress = rBuyAddress
scity = rcity
sState = rState
sZip = rZip
sEmailAddres = lblEmailAddres.Text
sBuyersCounty = lblBuyersCounty.Text
sSalesTax = lblSalesTax.Text
sSSN = lblSSN.Text
sDOB = lblDOB.Text
'Lets get the Current Logged on User
SlsManLoginN = lblSlsRep.Text
myConnection = New SqlConnection
myConnection.ConnectionString = connString
myConnection.Open()
CPhoneNum = lblHnum.Text
CWorkNum = lblWnum.Text
CCellNum = lblCnum.Text
Const sql As String = "Insert into CustomerTable (WorkSheetID, Origin, DealerName, DateCreated, SalesRep, " _
+ "BkupSalesRep, FirstName, MiddleName, LastName, Address, City, State, Zip, HomePhone, WorkPhone, " _
+ "CellPhone, Email, County, SalesTax, SS#, DOB) Values (@WorkSheetID, @Origin, @DealerName, @DateCreated, " _
+ "@SalesRep, @BkupSalesRep, @FirstName, @MiddleName, @LastName, @Address, @City, @State, @Zip, @HomePhone, @WorkPhone, @CellPhone, @Email, @County, @SalesTax, @SS#, @DOB)"
myCommand = New SqlCommand(sql, myConnection)
With myCommand.Parameters
.Add(New SqlParameter("@WorkSheetID", sWorkSheetNum))
.Add(New SqlParameter("@Origin", sSaleOrigin))
.Add(New SqlParameter("@DealerName", sDealerShipName))
.Add(New SqlParameter("@DateCreated", sDateCreated))
.Add(New SqlParameter("@SalesRep", SlsManLoginN))
.Add(New SqlParameter("@BkupSalesRep", sBkupSlsRep))
.Add(New SqlParameter("@FirstName", sFirstName))
.Add(New SqlParameter("@MiddleName", sMiddleName))
.Add(New SqlParameter("@LastName", slastname))
.Add(New SqlParameter("@Address", sBuyAddress))
.Add(New SqlParameter("@City", scity))
.Add(New SqlParameter("@State", sState))
.Add(New SqlParameter("@Zip", sZip))
.Add(New SqlParameter("@HomePhone", CPhoneNum))
.Add(New SqlParameter("@WorkPhone", CWorkNum))
.Add(New SqlParameter("@CellPhone", CCellNum))
.Add(New SqlParameter("@Email", sEmailAddres))
.Add(New SqlParameter("@County", sBuyersCounty))
.Add(New SqlParameter("@SalesTax", sSalesTax))
.Add(New SqlParameter("@SS#", sSSN))
.Add(New SqlParameter("@DOB", sDOB))
End With
ra = myCommand.ExecuteNonQuery()
myConnection.Close()
[/FONT]
Thank you!!!!!
Parameterized Query '(@WorkSheetID nvarchar(14),@Origin nvarchar(5),@DealerName nvarc' expects parameter @Address, which was not supplied.
[FONT=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif]Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Parameterized Query '(@WorkSheetID nvarchar(14),@Origin nvarchar(5),@DealerName nvarc' expects parameter @Address, which was not supplied.
Source Error:
Line 401: .Add(New SqlParameter("@DOB", sDOB))Line 402: End WithLine 403: ra = myCommand.ExecuteNonQuery()Line 404: myConnection.Close()Line 405: 'Lets Check to see if there is a Co Applicant
Here is my Code:
Dim ra As Integer
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim connString As String = "Server=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|CustomerInfo.mdf;Integrated Security=True;User Instance=True"
Dim CPhoneNum, CWorkNum, CCellNum, sWorkSheetNum, sSaleOrigin As String
Dim sDealerShipName, sBkupSlsRep, sDateCreated, sFirstName, sMiddleName, slastname, sBuyAddress, sSSN, sDOB As String
Dim scity, sState, sZip, sEmailAddres, sBuyersCounty, sSalesTax As String
Dim SlsManLoginN As String
Dim myPrincipal As IPrincipal = Me.User
'Customer Information
sWorkSheetNum = lblCustWksnum.Text
sSaleOrigin = lblSaleOrigin.Text
sDealerShipName = lblDealerShipName.Text
sDateCreated = lblDateCreated.Text
sBkupSlsRep = lblBkupSlsRep.Text
sFirstName = lblcFirstName.Text
sMiddleName = lblcMiddleName.Text
slastname = lblcLastName.Text
sBuyAddress = rBuyAddress
scity = rcity
sState = rState
sZip = rZip
sEmailAddres = lblEmailAddres.Text
sBuyersCounty = lblBuyersCounty.Text
sSalesTax = lblSalesTax.Text
sSSN = lblSSN.Text
sDOB = lblDOB.Text
'Lets get the Current Logged on User
SlsManLoginN = lblSlsRep.Text
myConnection = New SqlConnection
myConnection.ConnectionString = connString
myConnection.Open()
CPhoneNum = lblHnum.Text
CWorkNum = lblWnum.Text
CCellNum = lblCnum.Text
Const sql As String = "Insert into CustomerTable (WorkSheetID, Origin, DealerName, DateCreated, SalesRep, " _
+ "BkupSalesRep, FirstName, MiddleName, LastName, Address, City, State, Zip, HomePhone, WorkPhone, " _
+ "CellPhone, Email, County, SalesTax, SS#, DOB) Values (@WorkSheetID, @Origin, @DealerName, @DateCreated, " _
+ "@SalesRep, @BkupSalesRep, @FirstName, @MiddleName, @LastName, @Address, @City, @State, @Zip, @HomePhone, @WorkPhone, @CellPhone, @Email, @County, @SalesTax, @SS#, @DOB)"
myCommand = New SqlCommand(sql, myConnection)
With myCommand.Parameters
.Add(New SqlParameter("@WorkSheetID", sWorkSheetNum))
.Add(New SqlParameter("@Origin", sSaleOrigin))
.Add(New SqlParameter("@DealerName", sDealerShipName))
.Add(New SqlParameter("@DateCreated", sDateCreated))
.Add(New SqlParameter("@SalesRep", SlsManLoginN))
.Add(New SqlParameter("@BkupSalesRep", sBkupSlsRep))
.Add(New SqlParameter("@FirstName", sFirstName))
.Add(New SqlParameter("@MiddleName", sMiddleName))
.Add(New SqlParameter("@LastName", slastname))
.Add(New SqlParameter("@Address", sBuyAddress))
.Add(New SqlParameter("@City", scity))
.Add(New SqlParameter("@State", sState))
.Add(New SqlParameter("@Zip", sZip))
.Add(New SqlParameter("@HomePhone", CPhoneNum))
.Add(New SqlParameter("@WorkPhone", CWorkNum))
.Add(New SqlParameter("@CellPhone", CCellNum))
.Add(New SqlParameter("@Email", sEmailAddres))
.Add(New SqlParameter("@County", sBuyersCounty))
.Add(New SqlParameter("@SalesTax", sSalesTax))
.Add(New SqlParameter("@SS#", sSSN))
.Add(New SqlParameter("@DOB", sDOB))
End With
ra = myCommand.ExecuteNonQuery()
myConnection.Close()
[/FONT]