Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VB: SQL 2000 Tabellen importieren

Empfohlene Antworten

Veröffentlicht

Hi,

ich habe ien Programm geschrieben(in VB 6.0). Dieses Programm greift auf eine Access Datenbank zu und speichert in Ihr Daten.

Es soll noch eine Import funktion für 4 Tabelle aus einem SQL 2000 Server geschrieben werden. Bei dieser Funktion sollen die Tabelle einfach nur in die AccessDB importiert werden, mehr nicht.

Wie setzte ich den Import am Besten um? Über eine ODBC - Verbindung?

Kann mir jemand vielleicht ein Beispiel Programm zeigen?

Gruß

netfireman

per ODBC holen und dann halt in die Access DB schreiben...

beispiel? hmmm... *kram*


Sub Main2()

On Error GoTo DBerr
Dim rsdas As ADODB.Recordset
Dim strQuery As String
Dim ODBC_Name As String
Dim ConnectServer As String
Dim ODBC_USER As String, ODBC_USER_PW As String
Dim strBack As String
Dim Dateinr As Integer
Dim strFelder As String
Dim i As Integer
Dim fs

Dateinr = FreeFile

Set fs = CreateObject("Scripting.FileSystemObject")

Set rsdas = New ADODB.Recordset

strQuery = "SELECT * tabelle where feld >= to_date('" & datToday & "', 'DD.MM.YYYY');"
ODBC_Name = "DB_Name"
ODBC_USER = "User"
ODBC_USER_PW = "Password"
ConnectServer = "DSN=" + ODBC_Name + ";UID=" + ODBC_USER + ";PWD=" + ODBC_USER_PW

If rsdas.State = adOpenStatic Then
rsdas.Close
End If

rsdas.Open strQuery, ConnectServer, adOpenStatic

Open App.Path & "\file.csv" For Append As Dateinr
Do While Not rsdas.EOF
DoEvents
If Trim(rsdas!feld1) <> "" Then
strFelder = Trim(rsdas!feld1) & ";" & _
Trim(rsdas!feld2) & ";" & _
Trim(rsdas!feld2) & ";" & _
.
.
.
End If
rsdas.MoveNext
Print #Dateinr, strFelder
Loop
Close

Exit Sub

DBerr: App.LogEvent Err.Description, vbLogEventTypeError
End Sub
[/php]

so und anstatt das ganze per print in ne datei zu schreiben musst dus halt in deine Access DB schmeißen...

edit: natürlich musst du das ganze dann für deine zwecke noch etwas umbauen ;)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.