Here's my connection to the database.
Sub Page_Load(sender as Object, e as EventArgs)
'BindData()
End Sub
'Sub BindData()
Public Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'1. Create a connection
Dim strTxt as String
Dim conn as SQLconnection
Dim da as New SQLdataAdapter
Dim ds as New DataSet()
Dim cmd as SQLcommand
Dim newListItem1 as new ListItem()
Dim submit AS button
Dim beginDate As date
Dim endDate As Date
'Dim txtBeginDate As textbox
'Dim txtEndDate As textbox
txtBeginDate.text = beginDate
txtEndDate.text = endDate
conn = New SQLconnection("server=xxxxx; database=xxxxx; uid=xxxxx; pwd=xxxxx")
strTxt = "SELECT ID, MRN, Name, CheckInDate, Dept, Prov, DX1, DX1Desc, CPT1, CPT1Desc FROM OPPE_Clinic WHERE CheckInDate >= '"& beginDate & "' and CheckInDate <= '" & endDate & "' "
cmd = New SQLcommand(strTxt, conn)
'2. Create the command object, passing in the SQL string
Dim myCommand as New SqlCommand(strTxt, conn)
Dim myAdapter as New SqlDataAdapter(myCommand)
'Dim ds as New DataSet()
myAdapter.Fill(ds)
'Set the datagrid's datasource to the datareader and databind
conn.Open()
PPROClinic.DataSource = ds
PPROClinic.DataBind()
One.text = FormatDateTime(beginDate,2)
CheckInDate = Two.text
End Sub
Below is my datagrid and text boxes.
Replies
Know the answer? Post it — somebody with the same question will find it here.