Hi...
I have one problem regarding how to check whether the record already have or not then do insert or update...I'm using firebird database....i want to pull all record from one table to other database . Here my coding but i'm get stuck to do insert or update...hope anyone can help me...tq
Dim fbcmd As New FbCommand
Dim fbcmd1 As New FbCommand
Dim cmd As New FbCommand
fbcmd = New FbCommand("select * from CARDHOLDER ", IBSS)
IBSSNEW = New FbConnection("User=xxxx;" + "Password=XXXX;" + "Database=C:\ibss\database\ibss.gdb;" + "DataSource=a;" + "Port=3050;" + "Dialect=3;" + "Charset=NONE;" + "Role=;" + "Connection lifetime=15;" + "Pooling=true;" + "MinPoolSize=0;" + "MaxPoolSize=50;" + "Packet Size=8192;" + "ServerType=0")
IBSSOLD = New FbConnection("User=xxx;" + "Password=xxx;" + "Database=D:\ibss\database\ibss.gdb;" + "DataSource=b;" + "Port=3050;" + "Dialect=3;" + "Charset=NONE;" + "Role=;" + "Connection lifetime=15;" + "Pooling=true;" + "MinPoolSize=0;" + "MaxPoolSize=50;" + "Packet Size=8192;" + "ServerType=0")
IBSSUMP.Open()
IBSSDR = fbcmd.ExecuteReader()
Dim bFlag As Boolean = True
Do Until Not bFlag
While (IBSSDR.Read())
cmd = New FbCommand("SELECT * FROM CARDHOLDER WHERE CARDHOLDERID = '" & IBSSDR.Item(0).ToString & "' ", IBSSNEW)
Dim IBSSDR1 As FbDataReader
IBSSNEW.Open()
IBSSDR1 = cmd.ExecuteReader
Dim intVal As Integer
intVal = IBSSDR1.HasRows
While IBSSDR1.Read
If intVal > 0 Then
Console.ForegroundColor = ConsoleColor.Magenta
Console.WriteLine(vbTab & IBSSDR1.Item("CARDHOLDERID") & vbTab & IBSSDR1.Item("NAME"))
IBSSDR1.NextResult()
End If
If Not IBSSDR1.HasRows Then
Console.ForegroundColor = ConsoleColor.Green
Console.WriteLine(vbTab & IBSSDR.Item("CARDHOLDERID") & vbTab & IBSSDR.Item("NAME"))
IBSSDR1.NextResult()
End If
End While
IBSSNEW.Close()
End While
bFlag = IBSSDR.NextResult()
Loop