bghodsi 0 Newbie Poster

Hi folks:
I get the following error when I try to convert sql to access:
Microsoft JET Database Engine missing (;) at end of sql statement. The first part works fine but I get the error running second part.

Below is the complete coding in vb.net for data transfer.

Imports System.Data.OleDb
Imports System.Data.SqlClient
Public Class frmMain
    Inherits System.Windows.Forms.Form
    Private cnn As New SqlConnection
    Private cmd As New SqlCommand
    Private ConnectionString As String
    Private sql As String
    Private str As String
    Private cmdd As New OleDbCommand
    Private iCount As Integer




    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ConnectionString = "Server=hp;database=library;integrated security=SSPI;"

        MessageBox.Show("Connection established")

        sql = "SELECT snippetID, snippetName, snippetSource, snippetCode FROM snippet"
        Try
            cnn = New SqlConnection(ConnectionString)


            cnn.Open()
            cmd = New SqlCommand(sql, cnn)
            cmd.ExecuteNonQuery()

            cnn.Close()
            MsgBox("ExecutionNonQuery in SqlCommand executed")

        Catch ex As Exception
            MsgBox("Can not open the connection")
        End Try
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Try
            Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\tmp\lib.mdb")
            cn.Open()

            str = "insert into snip(snipID, snipName, snipSource, snipCode) values (@snipID, @snipName, " _
           & "@snipSource, @snipCode)IN 'c:\tmp\snip.mdb'"


            cmdd = New OleDbCommand(str, cn)
            iCount = cmdd.ExecuteNonQuery
            cn = Nothing
            MessageBox.Show(iCount)


        Catch ex As Exception

            '  MsgBox("Error:  " & ex.Source & "  " & ex.Message)

        End Try

    End Sub
End Class