Click to See Complete Forum and Search --> : Wanted: sample SQL connection in ASP.NET / VB.NET for 2005


yyiiyyii
March 3rd, 2007, 06:48 PM
Wanted: sample SQL connection in ASP.NET / VB.NET for 2005

i can do it in 2003 although i dont know how to get it work in 2005.

For Example this works in 2003

Protected dCon As SqlClient.SqlConnection
Protected dAdapter As SqlClient.SqlDataAdapter

Dim dtSoftwareTable As DataTable = New DataTable()
dCon = New System.Data.SqlClient.SqlConnection(ConnectionStringStr) '7
dAdapter = New SqlClient.SqlDataAdapter("select * from table", dCon)
dAdapter.Fill(dtSoftwareTable)

so how can i get this to work in 2005

mcmcom
March 5th, 2007, 10:19 AM
its pretty much the same in 2005 whats the problem your having?

the only real difference in 2005 is that if you store your connection string in web.config or app.config you can access it differently, like:

SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["myConStr"].ConnectionString);

also you put connection strings in a connectionString tag, not in appSettings anymore.

let us know whats not working so we can help better.
mcm