Ich versuche typisierte Datatables per SQL-DataAdapter zu befüllen. Mit "normalen" Tables funktioniert das auch.
Bei
DT as DataTable
& DT.fill(SqlDataAdapter)
funktioniert.Bei
DT as fehlerDataTable
kommt die Meldung "invalid object name 'fehler'". Allerdings weiss ich nicht so recht, was ich mit der Meldung anfangen soll.VB.NET-Quellcode
- Dim conn = New SqlClient.SqlConnection
- conn.ConnectionString = constr
- conn.Open()
- Dim dte As Date = DateSerial(Today.Year, Today.Month, 1)
- Dim sqlc As New SqlCommand("SELECT fehl_id, line_id, fehlcode_id, date FROM fehler WHERE date > @lastDate", conn)
- sqlc.Parameters.AddWithValue("@lastDate", dte)
- Dim sqlc2 As New SqlCommand("SELECT line_id, aldatum FROM aktivitaet WHERE aldatum > @lastDate", conn)
- sqlc2.Parameters.AddWithValue("@lastDate", dte)
- Dim sqlerror As SqlDataAdapter = New SqlDataAdapter(sqlc)
- Dim sqlprod As SqlDataAdapter = New SqlDataAdapter(sqlc2)
- Dim dtError As New DS_LF32.fehlerDataTable
- Dim dtProd As New DS_LF32.aktivitaetDataTable
- sqlerror.Fill(dtError)
- sqlprod.Fill(dtProd)
Option strict = on
If it's stupid and it works it ain't stupid.
If it's stupid and it works it ain't stupid.