c# - SqlConnection unable to connect using IP address -


pretty simple question.

i cannot connect using string:

 sqlconnection myconnection = new sqlconnection("network address=(192.168.1.120); password=userpassword; user id=username; database=mydb"); 

i try change data source, address, , anytime have period in string raises exception. if change point localhost name no period or hostname not using fdnq works fine. know what's that?

the exception raised when using ip address or server name several subdomains period invalid. "incorrect syntax near '.'."

i went connectionstrings.com , copied same string used before , failed.

my sqlcommand had bad sql syntax in due several lines of concatenation. stupid me.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -