.net - Database Connection in VB.NET Windows Forms -
i have problem connecting server machine. when try connecting machine following code, works fine:
'connstring = "data source = .\sqlexpress;" & _ '"initial catalog = one;" & _ '"integrated security = sspi" try conn = new sqlconnection(connstring) conn.open() messagebox.show("connection successful") catch ex exception messagebox.show(ex.message) end try
but when try connected machine sql server 2000 installed, timeout message. code follows:
connstring = "server = xxx.xxx.xxx.xxx;" & _ "initial catalog = one;user id=xxxx; password=xxxxx;" & _ "integrated security = sspi" try conn = new sqlconnection(connstring) conn.open() messagebox.show("connection successful") catch ex exception messagebox.show(ex.message) end try
can please me on issue?
imports system.io imports system.data.sqlclient public class supplier dim scon new sqlconnection //you write code in load event private sub supplier_load(byval sender system.object, byval e system.eventargs) handles mybase.load scon = new sqlconnection("your connection string") scon.open() end sub endclass
Comments
Post a Comment