Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


HOW TO FILL GRID VIEW WITH OUT USING SQLDATASOURCE AND
PROGRAMING?

Answers were Sorted based on User's Feedback



HOW TO FILL GRID VIEW WITH OUT USING SQLDATASOURCE AND PROGRAMING? ..

Answer / manumole

SqlConnection conn = new SqlConnection("Data
Source=MYSERVER;Initial Catalog=Northwind;User
Id=sa;Password=sa;");
conn.Open();
DataTable dt=new DataTable();
SqlDataAdapter da = new SqlDataAdapter("select
* from Employees", conn);
da.Fill(dt);
testGV.DataSource = dt;

Is This Answer Correct ?    15 Yes 8 No

HOW TO FILL GRID VIEW WITH OUT USING SQLDATASOURCE AND PROGRAMING? ..

Answer / sai_sanju84@yahoo.com

we can fill grid view by using sqldataadapter and dataset.
the code will be as follows........

using System.data.sqlclient (add namespace)

in code part....

sqlconnection con=new sqlconnection("server=(the server
which u use);database=(database in which your table
located);user id=;password=");

sqldataadapter da=new sqldataadapter("select * from
table",con);
dataset ds=new dataset();
da.fill(ds);
gridview1.datasourse=ds;
gridview1.databind();

Is This Answer Correct ?    8 Yes 3 No

HOW TO FILL GRID VIEW WITH OUT USING SQLDATASOURCE AND PROGRAMING? ..

Answer / chandra kiran

i think we have to fill the gridview without using SQL datasource???

dataset ds=new dataset();
datatable dt =new datatable();
dt.tablename="SQL";
ds.tables.add(dt);
data column dc1=new datacolumn();
dc1.columnname="SNo";
dc1.datatype=Type.getType("System.Int32");
dt.columns.add(dc1);
//we are added 1 column to our datatable we can achieve this //1 in 1 statement in yhe following way
datacolumn dc2=dt.columns.add("Name",Type.GetType("System.String"));
//so now we have a table with 2 columns(SNo , Name)
//now we have add records to our table
datarow dr1=dt.newrow();
dr1[0]=1;
dr1[1]="kiran";
dt.rows.add(dr1);//we added 1 record
datarow dr2=dt.newrow();
dr2[0]=2;
dr2[1]="varma";
dt.rows.add(dr2);//in the same way we can add rows better //use arrays
//now we have a dataset and a datatable(SQL) inthat one and //this datatable contains two columns & 2 records now we //have to bind this 1 with our gridview
gridview.datasource=ds.tables[0] ;or
gridview.datasource=ds.tables["SQL"];or
gridview.datasource=dt;

output in gridview like
---------------------------------
SNo Name
---------------------------------
1 kiran
2 varma

Is This Answer Correct ?    5 Yes 3 No

HOW TO FILL GRID VIEW WITH OUT USING SQLDATASOURCE AND PROGRAMING? ..

Answer / srikanth chodavarapu

Drag and drop the table on browser,difultly it shows grid
view ..

Is This Answer Correct ?    6 Yes 7 No

Post New Answer

More ADO.NET Interview Questions

What happens when u try to update data in a dataset in .NET while the record is already deleted in SQL SERVER as backend?

5 Answers  


What is ole in vb?

0 Answers  


can anybody show me the structure of ADO.NET

1 Answers  


What is a dynaset in access?

0 Answers  


What Is Difference Between Ado And Ado.net?

0 Answers   BirlaSoft,


what is the syntax code for oldb to connect oracle?

2 Answers  


What is the functionality of data provider in ado.net?

0 Answers  


What happens when we issue Dataset.ReadXml command?

1 Answers  


What do you know about ado.net's methods?

0 Answers  


What is the main difference between ADO and ADO.Net

4 Answers   HCL,


What is the full form of ado?

0 Answers  


What is connection pooling and what is the maximum pool size in ado.net connection string?

0 Answers  


Categories