473,322 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Gridview not showing results of query

347 100+
I have the following code on my page

[code]
Imports System.Data.SqlClient
Imports System.Data
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
TimeDateLabel.Text = String.Format("Today is {0:F}", DateTime.Now)
schedulenameBox.Focus()
End Sub
Protected Sub GetOncall()
Dim dt As New DataTable
Dim da As New SqlDataAdapter
Dim cmd As New SqlCommand
Dim connectionString As String = "Initial Catalog=mdr;Data Source=xxxxx;uid=xxxxx;password=xxxxx"
Dim con As New SqlConnection(connectionString)
con.Open()
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "sp_getoncallresults"
cmd.Parameters.AddWithValue("@schedname", schedulenameBox.Text)
cmd.Parameters.AddWithValue("@sincedate", sincedateBox.Text)
Try
da.SelectCommand = cmd
da.Fill(dt)
GridView1.DataSource = dt
GridView1.DataBind()
con.Dispose()
Catch ex As Exception
Response.Write("Error:" & ex.Message)
End Try
End Sub

Protected Sub clearButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles clearButton.Click
schedulenameBox.Text = ""
sincedateBox.Text = ""
GridView1.DataSource = Nothing
GridView1.DataBind()
End Sub
End Class
[code]

and I can see that my values are passed to my variables when I debug the code but the results for my datatable show 0 rows. Can someone tell me what I may have done wrong?

Thank you

Doug
Apr 1 '11 #1
1 1630
VijaySofist
107 100+
Hi,

Check once whether you called the "GetOncall" Procedure. Because in the code you submitted it never seems to be called. Try Calling that Procedure in the Page_Load and also check ISPostBack Condition.

Regards
Vijay.R
Apr 4 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: - TW | last post by:
I need some help with a query. I have a table with inventory that I need to allow customer searches on. Based on their search criteria, a preference level is calculated; the higher the preference...
1
by: barry | last post by:
In a webform, I include as one of the parms a callback function in the beginInvoke function. Within the callback function put a literal into the textbox. The textbox is not being filled. I...
4
by: cihpet | last post by:
Hallo, I am beginner, I want to show on page results of this query: $query="SELECT mr_prehlad.mr_id, mr_kontakt.nazov_mr FROM mr_prehlad RIGHT JOIN mr_kontakt ON mr_kontakt.id_mr=mr_prehlad.mr_id...
1
by: =?Utf-8?B?cGVsZWdrMQ==?= | last post by:
i have a GridView which i can Page on (go to page 2,10,...) the thing is that i have a dynamic query which set the GridView from starts on page 1. the thing is that when i start to go over the...
1
by: =?iso-8859-1?B?R2VhcvNpZA==?= | last post by:
Strange problem... Have a gridview on a page (within an update panel) for displaying event dates. GridView loads fine first time around with the PageLoad. There are 2 text fields a user can...
1
by: rokuk | last post by:
Hi there! I am trying to run the following simple query from within VBA: ""INSERT INTO tempTable SELECT * FROM Deletions"" When I run this from the Access 2003 query wizard in SQL view, it...
0
by: www.douglassdavis.com | last post by:
Say I have a div with a form in it. What I would like to do is POST the form to a php script, then show the results that the php page outputs in that same div, without refreshing the entire page....
1
by: aaron5150 | last post by:
OK so here goes. I have created a table for my "employees details" including "employee number". I have also completed another table which shows orders by "employee number", details of order etc. ...
1
by: bluclouds9 | last post by:
I am new to Access and have been charged with creating a database for our course alumni. I currently have a "Contacts" form and am trying to create a subform to hold the course alumni...
5
f430
by: f430 | last post by:
i have a search form that filters a master table, my vba code is complete and is correct, the only problem i am facing is that after i search my filter tells me at the bottom of the form how many...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.