Hi again all...
I've tied out this new code, but I get one error no mather what I do with it.
*********************Error in Browser*******************************
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 15: Public Shared Function Conn() As SqlConnection
Line 16: Dim objConn As SqlConnection
******************Error Line**************************
Line 17: objConn.ConnectionString = CONSTRING
******************Error Line**************************
Line 18: objConn.Open()
******************CODE**************************** ****
Imports System.Data.SqlClient
Public Class GBV
Public Shared Function Connect() As SqlConnection
Dim Conn = New SqlConnection
Dim Command As New SqlCommand("set dateformat dmy", Conn)
Conn.ConnectionString = "provider=sqloledb;Server=sql.myweb.com;UID=User;D atabase=BASE;PWD=Password"
Conn.Open()
End Function
End Class
************************From File .ASPX.
VB***********************
GBV.Connect()
Response.Write(GBV.Connect())
Dim SQ As Data.SqlClient.SqlDataReader
Dim strTable As String
Try
GBV.Connect.CreateCommand.CommandText = ("select meTable from BASE where meTable = '" & MobileNr.Text & "'")
SQ = GBV.Connect.CreateCommand.ExecuteReader()
Response.Write(SQ)
Do While SQ.Read = True
strTable = SQ("meTable")
Loop
Catch ex As Exception
Response.Write(ex.Message)
End Try
SQ.Close()
*********************Tried*********************
I've tried encasulating everything in ()
Setting the ConnectionString as an variable and hardcoded and constant
raw copy of the code above
++++
After 5 hours I thought I'd try here again!
All help is Good help!
Regards
Michael