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...

syntax for binding the data from database

Answer Posted / sambhu sankar biswal

Actually There is no syntax to bind data from data base.

to bind data from data base
1st step:-create connection to database
2nd step:-write command
3rd step:-create object of data adapter(oledb/sql)
4th step:-create object of dataset
5th step:-dataadapter's object name.fill(dataset's object name);
6th step:-control name(where u have to bind the
data).DataSource=dataset's object name;
7th step:-control name(where u have to bind the
data).DataBind();



Example:-suppose we need to bind data from "emp" table to
gridview control


Code is bellow:-

Using system.Data.Oledb;//Name space

//inside page load event

OledbConnectionn cn=new
OledbConnection("provider=microsoft.jet.oledb.4.0;data
source=c:/db2.mdb");//complete path of the data base.
OledbCommand cmd=new OledbCommand("select * from emp",cn);
OledbDataAdapter da=new OledbDataAdapter(cmd);
DataSet ds= new DataSet();
da.fill(ds);
GridView1.DataSource=ds;
GridView1.DataBind();

Is This Answer Correct ?    7 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the features of dot net?

1049


Explain the difference between asp.net & vb.net and explain architecture?

943


What’s different between process and application in .net?

1012


What is dot net architecture?

989


How to prepare parametrized (with more than one parameters) crystal report. Please tell me the code procedure, if any body can?

905


What is the use of activex control in .net?

992


Do you know what is .net standard?

1030


What is the difference between asp.net and asp?

1094


Describe the compilation process for .net code?

1130


Please explain what is the .net framework and how does it work?

900


What is 'Common Type System' (CTS) in .NET?

1066


Can "this" be used within a static method?

1017


Explain what is a manifest in .net?

954


What is a variable of implicit type and what is its scope?

874


Explain can the validation be done in the server side? Or this can be done only in the client side?

887