Help with DataGrid

G

ges681

I am importing information from Access using a DataGrid and Query. In the
actually table the SP refers to the ID is used with formating (2008-****)
with the * being an incremental number. However when the data is brought
over to my Datagrid, the ID shows up as just the number (example: just "1"
instead of "2008-0001"). Is there a way to bring the formating over with the
record. It shows up on the query just fine.

Here is the VB code for the button that gets the information from the query
and populates the data grid:

Private Sub btnGetApptData_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnGetApptData.Click
cnnMIS.ConnectionString = _
"Provider=Microsoft.Jet.Oledb.4.0; Data Source =" & _
"MIS-DB.mdb"

odaMIS.SelectCommand = New OleDb.OleDbCommand

cnnMIS.Open()

With odaMIS.SelectCommand
.CommandType = CommandType.StoredProcedure
.Parameters.Add("@DoctorEmployeeID", OleDbType.VarChar, 255).
Value = txtDoctorID.Text
.CommandText = "spDoctorAppointmentLog" 'Stored procedure
.Connection = cnnMIS
End With

Try
cnnMIS.Close()
dsMIS.Clear()
odaMIS.Fill(dsMIS, "myApptTable") 'Fills the table dataset
Catch ex As Exception
MsgBox(ex.Message)
End Try

dtgAppts.DataSource = dsMIS.Tables("myApptTable")
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top