I am trying to set strCustomerNumber to CustomerNumber from tblcustomers
The tricky part is It has to be a specific Customer, so I have to retrieve the customerName from ddlCustomers before I can get the correct number here is my code:

Dim strCustomerNumber as new string("")
strCustomerNumber = ("SELECT CustomerNumber from tblcustomers Where CustomerName = " [U]ddlCustomers[/U])

I am getting ')' expected on "ddlCustomers"

Anyone have any suggestions?

Recommended Answers

All 3 Replies

strCustomerNumber = "SELECT CustomerNumber from tblcustomers Where CustomerName = '" & ddlCustomers & "'"

try it

strCustomerNumber = "SELECT CustomerNumber from tblcustomers Where CustomerName = '" & ddlCustomers.SelectedValue&"'

Had to do it this way.

localOutputServer = New SQLServer(ConfigurationManager.AppSettings("dbConnectionString"))
strSQL = New StringBuilder
strSQL.Append("SELECT PrintStreamACNO from tblcustomers Where CustomerName ='" & ddlCustomers.SelectedValue & "'")
localdr = localOutputServer.runSQLDataReader(strSQL.ToString)

If localdr.HasRows Then
If localdr.Read Then
strCustomerNumber = localdr(0).ToString
End If
End If

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.