Hi Alls,
I'm really need your's help...
I develop console application as a engine to pull data from oracle to SQL...the connection to both database is ok..but when to insert got problem....somebody help me plz....

'Connection To Sql

        Dim sqlcn As SqlConnection
        Dim sqldr As SqlDataReader
        Dim sqlda As SqlDataAdapter
        Dim sqlcmd As SqlCommand

        sqlcn = New SqlConnection("server=localhost;uid=sa;pwd=admin;database=SMARTKIOSK")


        'Connection to Firebird
        Dim fcmd As OdbcCommand
        Dim fcn As OdbcConnection
        Dim fdr As OdbcDataReader
        Dim fda As OdbcDataAdapter


        fcn = New OdbcConnection("DRIVER=Firebird/InterBase(r) driver;UID=SYSDBA;PWD=masterkey;DBNAME=172.19.100.4:c:\ibss\database\ibss.gdb;")

Try
sqlcn.Open()
            Console.WriteLine("OK")
fcn.Open()
            Console.WriteLine("OK")

fcmd = New OdbcCommand("select * from cardholder order by cardholderid ", fcn)
            fcn.Open()
            fdr = fcmd.ExecuteReader()
            Do
                While fdr.Read
                    Console.WriteLine(fdr(2))
sqlcmd = New SqlCommand("INSERT INTO smartkiosk.dbo.cardholder(cardholderid,name) values ('cardholderid','name')", sqlcn)
                    sqlcn.Open()
                    sqlcmd.ExecuteNonQuery()
                    sqlcn.Close()

                End While
 Loop While fdr.NextResult()
            Console.Read()

Hi

what is Error Message you got.

Thanks
Tank50

Actually i need to select information in firebird then insert the value into my SQL...but nothing happen.....please help me...

Dear kerek.

Connection opened twice - fcn.Open()

Dim sqlcn As SqlConnection
        Dim sqldr As SqlDataReader
        Dim sqlda As SqlDataAdapter
        Dim sqlcmd As SqlCommand

        sqlcn = New SqlConnection("server=localhost;uid=sa;pwd=admin;database=SMARTKIOSK")


        'Connection to Firebird
        Dim fcmd As OdbcCommand
        Dim fcn As OdbcConnection
        Dim fdr As OdbcDataReader
        Dim fda As OdbcDataAdapter

        fcn = New OdbcConnection("DRIVER=Firebird/InterBase(r) driver;UID=SYSDBA;PWD=masterkey;DBNAME=172.19.100.4:c:\ibss\database\ibss.gdb;")

   sqlcn.Open()
   fcn.Open()
   
   fcmd = New OdbcCommand("select * from cardholder order by 
                                              cardholderid ", fcn)
   fdr = fcmd.ExecuteReader()
    While fdr.Read
            Dim mcard as string
            Dim mname as string 
           ' Assign value of two columns to the vars.
            mcard=fdr.getString(0)
            mname=fdr.getString(1)

           sqlcmd = New SqlCommand("INSERT INTO cardholder(cardholderid,name) values ('" & mcard & "','" & mname & "')", sqlcn)
           sqlcmd.ExecuteNonQuery()
     End While
     sqlcn.Close()
     fdr.Close()
     fcn.Close()

Thanks bro...it working..but still got problem ooo. if there got DBNULL value it will stuck...how to ignore DBNULL Value?....thqnk again

Thanks,

Use IsDBNull Function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.