Re: Drag/Drop/Upload Functionallity

Tech-Archive recommends: Fix windows errors by optimizing your registry



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



.



Relevant Pages

  • Re: ADO connections question
    ... Function CreateADOObjects(ConnectionString as string) ... you'll see this error if the connection has not been ... I have a specific login form that calls the dbLogin function as shown ... Dim strCriteria As String ...
    (microsoft.public.access.adp.sqlserver)
  • Re: ADO connections question
    ... I have a module which creates the ADO connection object to validates the ... Function dbLogin(txtUser As String, txtPword As String, txtServer As String, ... I have a specific login form that calls the dbLogin function as shown below: ... Dim strCriteria As String ...
    (microsoft.public.access.adp.sqlserver)
  • Re: ExecuteReader requires an open and available Connection.
    ... you have ALL your users sharing one connection. ... Public Shared Function GetServerAs String ... Dim theServer As String ...
    (microsoft.public.dotnet.framework.aspnet)
  • DTS Transformation Data Task Errors
    ... Dim oIniFile As New IniFile ... Dim sServerName As String = oIniFile.GetString("Source Connection", ... ;ServerName* - String value representing the name or ip address of the ...
    (microsoft.public.sqlserver.dts)
  • Re: ExecuteReader requires an open and available Connection.
    ... you have ALL your users sharing one connection. ... Public Shared Function GetServerAs String ... Dim theServer As String ...
    (microsoft.public.dotnet.framework.aspnet)