J
jagdishl
Hi:
I have used the following code for my update query button I have used
VB.Net
Private Sub btncollections_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btncollections.Click
Const connstr As String = "Provider=sqloledb;Data Source=Athena;Initial
Catalog=OCACollections_DB;Integrated Security=SSPI;"
Dim objConn As New OleDbConnection(connstr)
Dim MYsql As String = "Insert into
tblCollectionReports(CasesAssessed,CostAssessed) Values
(@Cases,@AssessedCosts)"
Dim objcmd As New OleDbCommand(MYsql, objConn)
objcmd.CommandType = CommandType.StoredProcedure
With objcmd.Parameters
.Add(New OleDbParameter("@Cases", txtcases.Text))
.Add(New OleDbParameter("@AssessedCosts",
txtassessedcosts.Text))
End With
objcmd.Connection.Open()
objcmd.ExecuteNonQuery()
objcmd.Connection.Close()
Upon clicking I get the following error
Syntax error or access violation
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.OleDb.OleDbException: Syntax error or
access violation
Source Error:
Line 121: End With
Line 122: objcmd.Connection.Open()
Line 123: objcmd.ExecuteNonQuery()
Line 124: objcmd.Connection.Close()
Line 125: End Sub
Source File: C:\OCACollections\ProgramCollections.aspx.vb Line: 123
What is wrong with the above code please help?
I have used the following code for my update query button I have used
VB.Net
Private Sub btncollections_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles btncollections.Click
Const connstr As String = "Provider=sqloledb;Data Source=Athena;Initial
Catalog=OCACollections_DB;Integrated Security=SSPI;"
Dim objConn As New OleDbConnection(connstr)
Dim MYsql As String = "Insert into
tblCollectionReports(CasesAssessed,CostAssessed) Values
(@Cases,@AssessedCosts)"
Dim objcmd As New OleDbCommand(MYsql, objConn)
objcmd.CommandType = CommandType.StoredProcedure
With objcmd.Parameters
.Add(New OleDbParameter("@Cases", txtcases.Text))
.Add(New OleDbParameter("@AssessedCosts",
txtassessedcosts.Text))
End With
objcmd.Connection.Open()
objcmd.ExecuteNonQuery()
objcmd.Connection.Close()
Upon clicking I get the following error
Syntax error or access violation
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.OleDb.OleDbException: Syntax error or
access violation
Source Error:
Line 121: End With
Line 122: objcmd.Connection.Open()
Line 123: objcmd.ExecuteNonQuery()
Line 124: objcmd.Connection.Close()
Line 125: End Sub
Source File: C:\OCACollections\ProgramCollections.aspx.vb Line: 123
What is wrong with the above code please help?