SQL COnnection String with Variables Syntax Error

Can anyone share the syntax for a SQL connection string that has variables for the different parameter values? Need to pass the values of some textbox fields into the connection string but I get an End of Statement Expected Error with my string in Visual Studio 20102:

Public SQLCon As New SqlConnection With {.ConnectionString = "Server=" + sServer + ";Database=" + sDatabase + ";User=" + sUser + ";Pwd=" + sPW + ";"}

0 answers