473,382 Members | 1,392 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,382 software developers and data experts.

GridView is not being populated with data

347 100+
I have the following code:

Expand|Select|Wrap|Line Numbers
  1. Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim dt As DataTable
  3.         Dim connectionString As String = "Initial Catalog=mdr;Data Source=xxxxx;uidxxxxx;password=xxxxx"
  4.         Dim con As New SqlConnection(connectionString)
  5.         Dim cmd As New SqlCommand
  6.         con.Open()
  7.         cmd.Connection = con
  8.         cmd.CommandType = CommandType.StoredProcedure
  9.         cmd.CommandText = "getoncall"
  10.         cmd.Parameters.AddWithValue("@subschedule", TextBox1.Text)
  11.         Using da As New SqlDataAdapter(cmd)
  12.             dt = New DataTable
  13.             da.Fill(dt)
  14.             con.Close()
  15.             GridView1.DataSource = dt
  16.             GridView1.DataBind()
  17.         End Using
  18.  
and when I debug this code, I can see that my count in my Rows = {System.Data.DataRowCollection} is 1, which means that I'm getting the data, but I don't see anything in my datagridview. Can someone please tell me why?

Thank you

Doug
Mar 7 '11 #1
1 1899
Hi Doug,

Same code i tried in my PC, It was working fine.I think you are not getting data properly.please check
1.Check the connection.
2.Check the stored procedure what it accept parameter weather it is int or string.

Thanks
Vivek Kapile
Mar 21 '11 #2

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

Similar topics

0
by: bsaran | last post by:
Hi, I have a code that sort of works. The event flow is as follows: In a user control of type "FilterControl" user selects certain values from 3 related dropdown lists. (two of them have auto...
1
by: Ronj | last post by:
Using GridView (asp.net 2.0) is it possible to "add" data to the grid directly. I only see examples of delete, and edit. Seems DataSource has the 'insert' command to do so. If so, can you direct me...
1
by: ad | last post by:
I use GridView in a Web Form. When the data is empty, it only who the EmptyDataText or EmptyDataTempate, and all the field is invisible How can I show all the field when the data is empty?
2
by: Philip | last post by:
I can use a GridView and ObjectDataSource to bind my data using "Eval" expressions ... provided the GridView and related Column TemplateFields are defined as inline HTML. I prefer to...
6
by: Badis | last post by:
Hi, I'm tyring to display data on my gridview but when the data Exceeds "154161" record the gridview doesn't display it..!!? Cheers
3
by: Sahar Madahian | last post by:
Hi, I'm new in .net and I want to use a gridview with a datasource in code behind. This is an example that I copied from the book, but I've got error. Maybe I need to add some code to web config...
0
by: Steve Kershaw | last post by:
I'm working on this project in which I have an <asp:GridView object already filled with data. I also have a VBScript (client side) script that needs to access this data. I've tried: dim test =...
0
by: =?Utf-8?B?S3VydCBvZiBTYW4gSm9zZQ==?= | last post by:
All- Please advise as to what's the best way to display data in a column in a grid view (and I'm using a dataset) in a table (say TABLE2) which: - is non-zero only if a boolian field in the...
0
by: icanhelp33 | last post by:
I am using a method to group data in Gridview. I am able to compare one sortexpression with the gridview field. I would also like to compare sortexpression2 with another gridviewfield. How is that...
2
by: Ghayas | last post by:
Hello, its quite strange that i m itearing a gridview to get some of its cell data but its not show me data, i m doing like this for i=0 to GView.rows.count-1 ...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.