Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Jimmy Hawkins   on Jan 06 In Asp.net Category.

  
Question Answered By: Elisabeth Bell   on Jan 06

#1
http://www.learnasp.com/freebook/learn/index.aspx?caller=utilitybelt§ion=Databases
the first 6 lessons show you exactly that.

#2 Common Sin:
Using Datasets to fill because the the Micrososft Quickstarts Docs do (mostly because they were written in Beta1 before ExecuteReader existed) , i.e.


Dim DS As DataSet
Dim MyConnection As OLEDBConnection
Dim MyCommand As OLEDBDataAdapter

MyConnection = New OLEDBConnection("....")
MyCommand = New OLEDBDataAdapter("select * from publishers where
state='NY'", MyConnection)

DS = new DataSet()
MyCommand.Fill(ds, "NYStateOfMind")

MyDataGrid.DataSource=ds.Tables("Authors").DefaultView
MyDataGrid.DataBind()
MYConnection.Close()

when a
=> Executereader does the job much much much faster <=
without all the overhead of dataset object and with less code:

Dim MyConnection As new OLEDBConnection("....")
Dim MyCommand As OLEDBCommand("select * from publishers where state='NY'")
DIM myreader as new
OLEBDBReader()=MyCommand.ExecuteReader(system.data.commandbehavior.closeconnection)
MyDataGrid.DataSource=myreader
MyDataGrid.DataBind()
myReader.Close()

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on ASP.Net Form to Database Or get search suggestion and latest updates.


Tagged: