hello everyone i am an new member here..
my problem is tha i want to know if a database table in sql server exists
i want to do this because i want to avoid an exception of select from a table tha doesnt exist
i use this code
Dim con As SqlConnection = New SqlConnection(Session("DBConString"))
Dim drw As SqlDataReader
Dim mycommandw As New SqlCommand("IF EXISTS (SELECT name FROM sysobjects WHERE name = 't_text' AND type = 'U') select text_caption from t_text where text_id=1", con)
con.Open()
drw = mycommandw.ExecuteReader()
prosopikaminimata.Text = drw(0)
and the exception message i reseave is(translated from greek)
"the read try is not valid because no data exist"
have anyone an idea??
my problem is tha i want to know if a database table in sql server exists
i want to do this because i want to avoid an exception of select from a table tha doesnt exist
i use this code
Dim con As SqlConnection = New SqlConnection(Session("DBConString"))
Dim drw As SqlDataReader
Dim mycommandw As New SqlCommand("IF EXISTS (SELECT name FROM sysobjects WHERE name = 't_text' AND type = 'U') select text_caption from t_text where text_id=1", con)
con.Open()
drw = mycommandw.ExecuteReader()
prosopikaminimata.Text = drw(0)
and the exception message i reseave is(translated from greek)
"the read try is not valid because no data exist"
have anyone an idea??