Wednesday, December 23, 2009

I would like to put the SQL connection string in a place where I can call the functions of it without coding it every time... ie Dim ds As New DataSet Dim da As SqlClient.SqlDataAdapter Dim sql As String sql = "Select * from Customers" oConn.ConnectionString = "Data Source=192.168.1.2,5000;Initial Catalog=databasename;UID=sa;Password=xxxxx" oConn = New SqlClient.SqlConnection() oConn.Open() Dim da As New SqlDataAdapter(sql , oConn) oConn.Close()I would like to be able to code it like this... Dim SQL As String Dim ado As New MyADO Dim DT As New DataTable SQL = "SELECT ID, SF_First+' '+SF_Last AS FullName FROM SFMember ORDER BY LastName" DT = ado.ExecuteTableQuery(SQL) ado.Dispose()When I do this I get this Error 1 Module 'ADO' cannot be used as a type. In this istance MyAdo Class would have all the connection string information that I would need. (See Below code for a sample of what I ment) also i would like to be able to change the location on the server and not have it hardcoded in my code.. On the code below I dont know where to put the server connection info either. I had a class that did this for 2003 and 2005 but will not work in 2008 for some reason.. ThanksChris