Hope this helps;
<code>
/* ### In Web.config BEGIN ### */
<configuration>
<appSettings>
<add key="IntranetConnStr_Core" value="Data
Source=<DBServerName_Here>;user
id=<UserID_Here>;password=<Password_Here>;initial catalog=<DB_Here>" />
</appSettings>
/* ### In Web.config END ### */
/** Calling code BEGIN **/
Dim dvEventStatuss As New DataView
'Note! strSQLToRun = I read the SQL CMD in from a XLM file.
dvEventStatuss = Do_Get.Do_DBConnection("TBL_EventStatuss", strSQLToRun,
ConfigurationSettings.AppSettings(strConnStr), (strWhoCalledMe &
".Do_DBGridInit"), objVisitor)
With uwgOrderEventStatuss
.DataSource = dvEventStatuss
.DataBind()
end with
/** Calling code BEGIN **/
Public Function Do_DBConnection(ByVal strTBLName As String, ByVal strSQL As
String, ByVal strConnStrToUse As String, ByVal strWhoCalledMe As String,
ByVal objVisitor As clsSiteFunctions.clsUser) As DataView
Dim dvDataView As New DataView
Dim dsDataSet As New DataSet
Dim Connection As New SqlConnection
Try
strConnStrToUse = "IntranetConnStr_Core"
strSQL = "Select * FROM <TableName_Here>"
strTBLName = "TBL_TableName"
Connection.ConnectionString =
ConfigurationSettings.AppSettings(strConnStrToUse)
Dim Adapter As New SqlDataAdapter(strSQL, Connection)
Adapter.Fill(dsDataSet, strTBLName)
Connection.Open()
dvDataView.Table = dsDataSet.Tables(strTBLName)
Adapter.Dispose()
Connection.Close()
Connection.Dispose()
Catch
End Try
Do_DBConnection = dvDataView
End Function
</code>