VB.Net ile AS400’e bağlanmak

Imports System.Data.Odbc
Private Sub connectas400()
Dim vl As String
Dim MyODBCConnection As New OdbcConnection("Driver={Client Access ODBC Driver (32-bit)};" & _
"System=BAĞLANILACAK SİSTEM IPsi;" & _
"TRANSLATE=1;" & _
"Uid=KULLANICI ADI;" & _
"Pwd=ŞİFRE")
MyODBCConnection.Open() 'burada bağlantıyı açıyoruz
Dim SRG, vl As String
SRG = "SELECT * FROM FILE.TABLE WHERE .... GROUP BY .... ORDER BY 1"  'BURAYA SORGUMUZU YAZIYORUZ.
Dim selectCMD As OdbcCommand = New OdbcCommand(SRG, MyODBCConnection)
Dim dr As OdbcDataReader = selectCMD.ExecuteReader()
Try
While dr.Read
vl = vl & dr.GetValue(0) & vbTab & dr.GetValue(1) & vbTab & dr.GetValue(2) & dr.GetValue(3) & vbNewLine
End While
Catch ex As Exception
End Try
MyODBCConnection.Close()
MyODBCConnection.Dispose()
TextBox1.Text = vl
End Sub
Previous Article
Next Article

Bir cevap yazın

Your email address will not be published. Required fields are marked *.

*
*
You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>