Re: Drag/Drop/Upload Functionallity
- From: "Patrice" <http://www.chez.com/scribe/>
- Date: Thu, 22 Mar 2007 10:39:55 +0100
Ok the error message is actually misleading as the method name is not
correct. This is actually in the insertion statement where you use to string
that dumps the type name inside the SQL statement resulting in a SQL syntax
error...
Please post a message if you solve the problem. I'll try to post a sample
later today so that you can go back on better tracks...
----
Patrice
"Webbyz" <mail.webb@xxxxxxxxx> a écrit dans le message de news:
1174499501.120635.254940@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Well at this point the GetData is gathering the Data and passing it
into the Db.
Here is the Module for that function.
Module DataAccessModule
Friend Function GetData(ByVal strSQL As String, ByVal TableName As
String) As DataSet
Dim myDataset As DataSet = New DataSet
' Create our connection string
Dim myConnString As OleDbConnection = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:
\db1.mdb")
' Create our command
Dim myCommand As OleDbCommand = New OleDbCommand(strSQL,
myConnString)
' Create our data adapter
Dim myDataAdapter As OleDbDataAdapter = New OleDbDataAdapter
' Assign the SQL command to the data adapter
myDataAdapter.SelectCommand = myCommand
Try
' Fill the dataset with the data from our command
myDataAdapter.Fill(myDataset, TableName)
' Return the dataset
GetData = myDataset
Catch ex As OleDbException
MsgBox("An error was thrown by the ADO.Net component in
the GetData function. Error Details: " & _
vbCr & ex.Message, MsgBoxStyle.Exclamation, "Error!")
Debug.WriteLine("SQL Statement: " & strSQL)
GetData = Nothing
Finally
' Close the connection and destroy our connection objects
myCommand.Connection.Close()
myDataset = Nothing
myConnString = Nothing
myCommand = Nothing
myDataAdapter = Nothing
End Try
End Function
Friend Function UpdateData(ByVal strSQL As String) As Integer
' Create our connection string
Dim myConnString As OleDbConnection = New
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:
\db1.mdb")
' Create our command
Dim myCommand As OleDbCommand = New OleDbCommand(strSQL,
myConnString)
Try
' Open the connection
myCommand.Connection.Open()
' execute the SQL
UpdateData = myCommand.ExecuteNonQuery()
Catch ex As OleDbException
MsgBox("An error was thrown by the ADO.Net component in
the GetData function. Error Details: " & _
vbCr & ex.Message, MsgBoxStyle.Exclamation, "Error!")
Debug.WriteLine("SQL Statement: " & strSQL)
UpdateData = Nothing
Finally
' Close the connection and destroy our connection object
myCommand.Connection.Close()
myConnString = Nothing
myCommand = Nothing
End Try
End Function
End Module
.
- Follow-Ups:
- Re: Drag/Drop/Upload Functionallity
- From: Patrice
- Re: Drag/Drop/Upload Functionallity
- References:
- Drag/Drop/Upload Functionallity
- From: Webbyz
- Re: Drag/Drop/Upload Functionallity
- From: Patrice
- Re: Drag/Drop/Upload Functionallity
- From: Webbyz
- Re: Drag/Drop/Upload Functionallity
- From: Patrice
- Re: Drag/Drop/Upload Functionallity
- From: Webbyz
- Re: Drag/Drop/Upload Functionallity
- From: Patrice
- Re: Drag/Drop/Upload Functionallity
- From: Webbyz
- Re: Drag/Drop/Upload Functionallity
- From: Patrice
- Re: Drag/Drop/Upload Functionallity
- From: Webbyz
- Drag/Drop/Upload Functionallity
- Prev by Date: Re: Cannot clear all rows in datagridview
- Next by Date: RE: XML documentation file name
- Previous by thread: Re: Drag/Drop/Upload Functionallity
- Next by thread: Re: Drag/Drop/Upload Functionallity
- Index(es):
Relevant Pages
|