|
-
Aug 16th, 2007, 06:48 PM
#1
Thread Starter
Junior Member
Filling DataGridView using Sql Statement
hello there
i am steve, working an a project for my course, i actually got a problem...
i have got a table called "Appoitments" in oracle database, i have created a datagridview on the vb form trying to reterive data in the datagridview, i.e appointments of any perticular date selected by the user,
so i wrote a sub procedure to get the data and fill in the datagridview,
when i run the form its not loading any thing it just showing the attributes name thats it... i dont know what the problem is, then i changed my SQL statement to simple " Select * from Appointments" then its working fine, data is loaded in the datagridview.
but i actually want the user to select the data from the calender and click the button , so all the appointments for that perticular date will be displayed on the form, can you please help me out its urgent my time is running out
here is my code:-
Dim conn As New OleDbConnection()
Dim connectionString As String = "Provider=OraOLEDB.Oracle;Data Source=orcl;User ID=scott;Password=steve;OLEDB.NET=true;" 'using OLEDB .Net Data Provider features
'Connection to datasource, using connection parameters given above
conn = New OleDbConnection(connectionString)
'Open database connection
conn.Open()
'Instantiate OleDbDataAdapter to create DataSet
Dim appointmentAdapter As OleDbDataAdapter = New OleDbDataAdapter()
'Fetch Product Detailsnn)
appointmentAdapter.SelectCommand = New OleDbCommand("SELECT APPOINTMENTTIME, REASONFORVISIT, PRIORITY, PATIENTID, DOCTORNUMBER FROM APPOINTMENTS WHERE APPOINTMENTDATE='16-JUL-07'", conn)
'In-Memory cache of data
Dim appointmentDataSet As DataSet = New DataSet("appointmentDataSet")
'Fill the dataset
appointmentAdapter.Fill(appointmentDataSet, "APPOINTMENTS")
DataGridView1.DataSource = appointmentDataSet
DataGridView1.DataMember = "APPOINTMENTS"
can any one help me out please its urgent...it will be greatfull
thank you
- steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|