Question

I am loading an HTML select item in Razor for a Webpage using VB.NET.

<select name="dropdownEmployees" id="dropdownEmployee" > 
    <option value="" selected="selected">-- Select Employee --</option>

    @For Each row In db.Query(strEmployeeList)
        @<option value="@row.EmployeeID">"@row.Employee"</option>
    Next row

</select>

And then I get this error when I try to run the page in a browser:

Format of the initialization string does not conform to specification starting at index 0.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Format of the initialization string does not conform to specification starting at index 0.

Source Error:

Line 63: -- Select Employee -- Line 64:
Line 65: @For Each row In db.Query(strEmployeeList) Line 66:
@"@row.Employee" Line 67:
Next row

I am not sure what to look at since the syntax looks correct. I am using VB.NET on this project per a client requirement but having done this in C# seems to be similar in comparison.

Connection string:

<connectionStrings>
    <add name="NomexCS" connectionString="Data Source=WEBSQL1\PLCSQL;Initial Catalog=Nomex;User ID=********;Password=*******;"/>
  </connectionStrings>
Was it helpful?

Solution 2

The problem turned out to be my connection string. It was wrong.

OTHER TIPS

Try this instead

@For Each row In db.Query(strEmployeeList)
    @<option value=@row.EmployeeID>@row.Employee</option>
Next row
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top