sql - Checking if database contains table -


i created coding program check if table exists in database. keeps underlining restrictions in coding. error 23 value of type 'string' cannot converted '1-dimensional array of string' can please tell me did wrong , check if rest of coding correct.

here coding:

    dim cn new sqlclient.sqlconnection(sql_loader("", my.settings.sql_win_auth, _          my.settings.sql_username, my.settings.sql_password, my.settings.sql_server_name, _          my.settings.sql_db_name))     dim cmd new sqlclient.sqlcommand     dim reader sqlclient.sqldatareader      cmd.connection = cn      cn.open()      dim restrictions string     restrictions = "pastel_companies"     dim dbtbl datatable = cn.getschema("pastel_companies", restrictions)      if dbtbl.rows.count = 0         messagebox.show("table not exist")     else         messagebox.show("table exists")     end if 

thank given

the correct syntax call getschema following

dim restrictions string() = new string() {nothing, nothing, "pastel_companies"} dim dbtbl datatable = cn.getschema("tables", restrictions) 

the first parameter collection want check existence of object (in case want check tables collection)
second parameter contains array of restrictions. array changes following collection want search. tables collection should apply 3 restrictions database, owner , tablename.
restrictions should appear in exact order expected, , if haven't value specify pass null value (nothing in vb)


Comments