Need Database Technical Help TIA!
I'm working on an INSERT function for a db query and I can't seem to get past this error. It seems so simple, but I just can't figure out where I'm going wrong. Here's what it does.
I have a confirm page where everything they previously entered is confirmed and shown using labels and contained in a form with a confirm button at the bottom. My goal is that when the user clicks to confirm everything that it makes the necessary INSERT into an Access db.
My error comes on the line of code that contains the type specifier for the sub. It tells me "End Of Statement Expected", but I've tried everything to fix it. Here's the error text and I've highlighted the line that's causing the error both in this code and in the full code below:
Compiler Error Message: BC30205: End of statement expected.
Source Error:
Line 170: ByVal billingEmail As String, _
Line 171: ByVal Sender As System.Object, _
Line 172: ByVal e As System.EventArgs) As Integer _
Line 173: Handles Confbtn.Click
Line 174:
Here's the full code for the db insert sub:
Sub ConfInsert( _
ByVal cardAmount As String, _
ByVal deliveryMethod As String, _
ByVal recipientName As String, _
ByVal recipientAddress As String, _
ByVal recipientCity As String, _
ByVal recipientState As String, _
ByVal recipientZip As String, _
ByVal recipientPhone As String, _
ByVal recipientEmail As String, _
ByVal senderName As String, _
ByVal billingName As String, _
ByVal billingAddress As String, _
ByVal billingCity As String, _
ByVal billingState As String, _
ByVal billingZip As String, _
ByVal billingPhone As String, _
ByVal billingEmail As String, _
ByVal Sender As System.Object, _
ByVal e As System.EventArgs) As Integer _
Handles Confbtn.Click
Dim connectionString As String = ConfigurationSettings.AppSettings("ConnectionString")
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)
Dim queryString As String = "INSERT INTO [GCOrders] ([CardAmount], [DeliveryMethod], [RecipientName], [Recipie"& _
"ntAddress], [RecipientCity], [RecipientState], [RecipientZip], [RecipientPhone],"& _
" [RecipientEmail], [SenderName], [BillingName], [BillingAddress], [BillingCity],"& _
" [BillingState], [BillingZip], [BillingPhone], [BillingEmail]) VALUES (@CardAmou"& _
"nt, @DeliveryMethod, @RecipientName, @RecipientAddress, @RecipientCity, @Recipie"& _
"ntState, @RecipientZip, @RecipientPhone, @RecipientEmail, @SenderName, @BillingN"& _
"ame, @BillingAddress, @BillingCity, @BillingState, @BillingZip, @BillingPhone, @"& _
"BillingEmail)"
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dbParam_cardAmount As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_cardAmount.ParameterName = "@CardAmount"
dbParam_cardAmount.Value = LblAmount.text
dbParam_cardAmount.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_cardAmount)
Dim dbParam_deliveryMethod As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_deliveryMethod.ParameterName = "@DeliveryMethod"
dbParam_deliveryMethod.Value = LblDelivery.text
dbParam_deliveryMethod.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_deliveryMethod)
Dim dbParam_recipientName As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_recipientName.ParameterName = "@RecipientName"
dbParam_recipientName.Value = LblRecipient.text
dbParam_recipientName.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_recipientName)
Dim dbParam_recipientAddress As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_recipientAddress.ParameterName = "@RecipientAddress"
dbParam_recipientAddress.Value = LblRAddress.text
dbParam_recipientAddress.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_recipientAddress)
Dim dbParam_recipientCity As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_recipientCity.ParameterName = "@RecipientCity"
dbParam_recipientCity.Value = LblRCity.text
dbParam_recipientCity.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_recipientCity)
Dim dbParam_recipientState As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_recipientState.ParameterName = "@RecipientState"
dbParam_recipientState.Value = LblRState.text
dbParam_recipientState.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_recipientState)
Dim dbParam_recipientZip As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_recipientZip.ParameterName = "@RecipientZip"
dbParam_recipientZip.Value = LblRZip.text
dbParam_recipientZip.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_recipientZip)
Dim dbParam_recipientPhone As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_recipientPhone.ParameterName = "@RecipientPhone"
dbParam_recipientPhone.Value = LblRPhone.text
dbParam_recipientPhone.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_recipientPhone)
Dim dbParam_recipientEmail As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_recipientEmail.ParameterName = "@RecipientEmail"
dbParam_recipientEmail.Value = LblREmail.text
dbParam_recipientEmail.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_recipientEmail)
Dim dbParam_senderName As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_senderName.ParameterName = "@SenderName"
dbParam_senderName.Value = LblName.text
dbParam_senderName.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_senderName)
Dim dbParam_billingName As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_billingName.ParameterName = "@BillingName"
dbParam_billingName.Value = LblBName.text
dbParam_billingName.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_billingName)
Dim dbParam_billingAddress As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_billingAddress.ParameterName = "@BillingAddress"
dbParam_billingAddress.Value = LblBAddress.text
dbParam_billingAddress.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_billingAddress)
Dim dbParam_billingCity As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_billingCity.ParameterName = "@BillingCity"
dbParam_billingCity.Value = LblBCity.text
dbParam_billingCity.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_billingCity)
Dim dbParam_billingState As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_billingState.ParameterName = "@BillingState"
dbParam_billingState.Value = LblBState.text
dbParam_billingState.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_billingState)
Dim dbParam_billingZip As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_billingZip.ParameterName = "@BillingZip"
dbParam_billingZip.Value = LblBZip.text
dbParam_billingZip.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_billingZip)
Dim dbParam_billingPhone As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_billingPhone.ParameterName = "@BillingPhone"
dbParam_billingPhone.Value = LblPhone.text
dbParam_billingPhone.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_billingPhone)
Dim dbParam_billingEmail As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_billingEmail.ParameterName = "@BillingEmail"
dbParam_billingEmail.Value = LblEmail.text
dbParam_billingEmail.DbType = System.Data.DbType.[String]
dbCommand.Parameters.Add(dbParam_billingEmail)
Dim rowsAffected As Integer = 0
dbConnection.Open
Try
rowsAffected = dbCommand.ExecuteNonQuery
Finally
dbConnection.Close
End Try
End Sub
I have a feeling that it's right in front of me and it's frustrating. Thanks for helping!
John

