c# - How to test a DNS connection? Just as the button "Test" in the ODBC Data Source Administrator? -


print showing button makes connection test

i wonder how write code in c# simulate button shown in above image.

any welcome.

check out. can add below code in form application on button click event.

string sqlconn = "data source=yourservername;initial catalog=dbname;user id=dbuser;password=dbuserpws;application name=mytestapp;" //for port number //string sqlconn = "data source=yourservername,5432;initial catalog=dbname;user id=dbuser;password=dbuserpws;application name=mytestapp;"  sqlconnection myconnection = new sqlconnection(sqlconn);  try {     myconnection.open();     messagebox.show("connected successfully");                } catch(exception e) {      messagebox.show("error. error message:" + ex.message);  } 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -