What is sequence of code in retrieving data from database ?
Answer Posted / payal
//In this answer there is sqlserver
/*i write this code in vb.net with windows applications and
use sql server provider*/
//first need namespace
system.data.sqlclient
//need connection,command,connection string
dim sqlcmd as sqlcommand
dim sqlcon as sqlconnection
dom da as sqldataadaptor
dim ds as dataset
dim constr as sting="user
password=sss;datasource=sds;initial catalog=fgf"
/*connection string give all details about database
connection initial catalog means data base name and data
source is sqlserver name,user id and password also*/
//open connection and pass connection string
sqlcon=new sqlconnection(constr)
sqlcon.open()
//create new object of command with new keyword
sqlcmd=new sqlcommand("select * from tablename",sqlcon)
/*data adapter is mediater between the data base and data
set because dataset is work in disconneted mode.*/
da=new sqldataadaptor(sqlcmd)
/*data adapter fetch query to data base and get answer and
fil the dataset using fill*/
da.fill(ds)
/*there is datagird which i use for display data on
form.data from dataset i use this bind to datagrid*/
datagird.datasource=ds.tables("table name")
| Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
Explain the differences between oledb sql server, oledbdotnet provider?
What is the difference between connected and disconnected environment?
What are the benefits of using of ADO.NET in .NET 4.0?
What is the maximum pool size in ado.net connection string?
Define data adapter?
Define the data provider classes that is supported by ado.net?
Which object holds only data and does not interact with data source?
How do you connect to sql server database without using sqlclient?
Is bulk insert faster than insert?
Define different execute methods of ADO.NET command object ?
What is csdl entity framework?
What is command class in ado.net?
What is a string variable?
How is entity framework different from ado.net?
Which object of ado contains datarow datacolumn collection?