I have a question about the Fillschema method. According the documentation the schema is built base on the contents of the SelectCommand. I using stored procedure to load tables in the dataset. I also use the fillschema to load the schema into my datatable. I'm not sure if things are working as I think they should. How would I get a schema loaded if I'm not using the Select query in the selectcommand? I'm using stored procedures instead. I have sample code below:
Sub CheckForAlertData(ByVal MinDevice As String)
Dim AlertDBConnection As SqlConnection = New SqlConnection(AlertVar.AlertConnectionString)
Dim AlertHist_ID As Integer
Dim AlertVehiclServiceID As Integer
Dim AlertOdometerID As Integer
Dim AlertReading As Integer
Dim ServiceID As Integer
Dim AlertThreadConnection As SqlConnection = New SqlConnection(AlertVar.AlertConnectionString)
'Read Min_GPS_History to get Min Device detail
Dim AlertThreadDataCMD As SqlCommand = New SqlCommand("SelectMinGPSHistoryByMin", AlertThreadConnection)
AlertThreadDataCMD.CommandType = CommandType.StoredProcedure
Dim AlertThreadParm As SqlParameter = AlertThreadDataCMD.Parameters.Add("@MinDevice", SqlDbType.VarChar, 10)
AlertThreadParm.Direction = ParameterDirection.Input
AlertThreadParm.Value = MinDevice
AlertThreadDataCMD.Parameters.Add(AlertThreadParm)
Dim AlertDA As SqlDataAdapter = New SqlDataAdapter(AlertThreadDataCMD)
AlertThreadConnection.Open()
AlertDA.FillSchema(AlertDS, SchemaType.Source, "MinGPSHistory")
AlertDA.Fill(AlertDS, "MinGSPHistory")
AlertDBConnection.Close()
End Sub
Thanks