function runs on scanner emulator, but not scanner itself (C#, SQL) -
i'm developing add-in scanner. i've run problems specific function i'm writing. problem seems connection string. code runs fine on scanner emulator, not on scanner itself. ideas going on?
i error error has occured while establishing connection server. when connecting sql server 2005, failure may caused fact... (provider: named pipes provider, error - 40 not open connection sql server)
the scanner uses active directory, think. may problem.
the code follows:
private bool confirmname(string clientid) { string clientname = ""; try { // setting sqlconnectionstringbuilder sqlconnectionstringbuilder buildit = new sqlconnectionstringbuilder(); buildit.datasource = "xxx.xx.x.xx"; buildit.initialcatalog = "test_clinical"; buildit.integratedsecurity = true; sqlconnection con = new sqlconnection(buildit.connectionstring); con.open(); using (sqlcommand command = new sqlcommand("select first_name, last_name background patient_no=@patient_no", con)) { command.parameters.addwithvalue("@patient_no", clientid); sqldatareader reader = command.executereader(); if (reader.hasrows) { reader.read(); clientname = reader.getstring(0).trim() + " " + reader.getstring(1).trim(); } // end if (reader.hasrows) else { // no client found id. return false; } // end else } // end using (sqlcommand command = new sqlcommand("select first_name, last_name background patient_no=@patient_no", con)) } // end try catch (exception err) { //messagebox.show(err.message); exporterhost.writesystemlog(logtype.error, "e9999999", "sql error: " + err.message); return false; } // @ point, should have valid client name. // creating dialog , giving appropriate text. sampledialog checkit = new sampledialog(); checkit.setquestion("do want scan document " + clientname + "?"); if (checkit.showdialog() == dialogresult.ok) { return true; } // end if (checkit.showdialog() == dialogresult.ok) else { return false; } // end else } // end confirmname
the system we're using developing handles sql connections on different port reason. problem.
still curious worked on emulator, not hardware though.
Comments
Post a Comment