Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to asp.net

Status
Not open for further replies.

kss1133

Programmer
Mar 22, 2006
22
US
I am a very good classic asp developer and I am use to having your data access stuff separate from your web pages so...

I want to populate a checkboxlist with values from a stored proc. Example "select * from authors" using pubs database. But I want all the dataaccess code to be a separate class (.vb) file.

All the example I find, they drag the control on the page then use the wizard to select the connection string and the sql statment then when you view the html source everything is in the control. I want the DB connection and sql statments or stored Procs to be in a seperate .vb file.

Can anyone please help me or point me in the correct direction, I have many books but I can't seem to make head or tails.

Also is this the best way or is the best way to use the wizards.

Thanks for any help or advice,
kss113
 
Basically, if you know how to write the database connection stuff, you can do it easily.

Public Class MyDBStuff
public function returnList() as DataTable
'Does DB stuff and Returns datatable
End function
End Class


then in your code behind

Dim a as New MyDBStuff

me.chkList.datasource = a.returnList
me.chkList.databind()

a = nothing

"...your mom goes to college..."
 
Use a separate DAL.. like you have been doing..

Just create a class file and figure out what objects you want to use:

Dim comm As SqlClient.SqlCommand
comm.CommandType = CommandType.StoredProcedure
comm.CommandText = "Your SP name"
comm.Connection = (connectin obj)

etc.

Search around, there are many examples out there...

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top