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

datagrid on my asp.net platform

Hi All,

I hav a datagrid on my asp.net platform..But itz not loading when i execute it...(or run the program...lets say a simplest one),,,,other controls are loading perfectly.....written below is d code....
A quick help will b appreciated...
thx
Shikhar

PROGRAM #####

Expand|Select|Wrap|Line Numbers
  1. using System.Data.SqlClient;
  2. public partial class _Default : System.Web.UI.Page 
  3. {
  4.     SqlDataAdapter da;
  5.    SqlConnection conn;
  6.     SqlCommand cmd;
  7.     DataSet ds = new DataSet();
  8.     protected void Page_Load(object sender, EventArgs e)
  9.     {
  10.        // conn = new SqlCommand("server=.;integrated security=yes;database=shikhar");
  11.         da = new SqlDataAdapter("select * from tr", "server=.;integrated security=yes;database=shikhar");
  12.             if (Page.IsPostBack== false)
  13.         {
  14.            fill();
  15.         }
  16.     }
  17.  
  18.     private void fill()
  19.     {
  20.     da.Fill(ds);
  21.         GridView1.DataSource=ds.Tables[0];
  22.         GridView1.DataBind();
  23.     }
  24.  
  25.     protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
  26.     {
  27.          String id="";
  28.         GridViewRow gr = GridView1.Rows[e.RowIndex];
  29.         id =gr.Cells[0].Text;
  30.         String del = "DELETE FROM tr WHERE id =" + id;
  31.         conn = new SqlConnection("server=.;integrated security=yes;database=shikhar");
  32.         cmd = new SqlCommand(del,conn);
  33.         conn.Open();
  34.          int r =cmd.ExecuteNonQuery();
  35.         if (r > 0)
  36.         {
  37.             fill();
  38.         }
  39.         conn.Close();
  40.     }
  41.  }
Feb 29 '08 #1
1 915
kenobewan
4,871 Expert 4TB
What happens if you just use ds as the datasource?
Mar 1 '08 #2

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

Similar topics

0
by: d_grantham | last post by:
I want to create a datagrid with a button in a cell that when clicked, it opens up a form allowing me to edit the information linked to that row in the datagrid. The datagrid is a summary of...
2
by: Dimitris Pantazopoulos | last post by:
Hello. I am trying to do the simplest of things. These are exactly the steps I follow: 1. create an sqlConnection to an SQL Server database. 2. create a DataSource and produce a DataSet to a...
0
by: d_grantham | last post by:
I want to create a datagrid with a button in a cell that when clicked, it opens up a form allowing me to edit the information linked to that row in the datagrid. The datagrid is a summary of...
2
by: Frank | last post by:
Hello, I am developing with VS.Net 2003 on the asp 1.1 platform. I am a few days new to using a datagrid. I found a nice tutorial and had no problems using an editable datagrid with textboxes...
2
by: Frank | last post by:
Hello, I am developing with VS.Net 2003 on the asp 1.1 platform. I am a few days new to using a datagrid. I found a nice tutorial and had no problems using an editable datagrid with textboxes...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.