I have a difficulty in parsing user input to a variable in an SQL sproc. I'm using linq as a go-between.
My web form contains, amongst other things, a textbox for a user to input a search parameter. This content has to be parsed from Text to a string, and subsequently to a char of 16 length. The data in the table that I am looking at is a char of the same length.
So, I tried the following:
public void GetASingleInvoice(string invoiceNumber)
{
char iNum = Convert.ToChar(invoiceNumber);
var invoice = from SIMS_InvoiceNo in financedb.INVOICEs
where SIMS_InvoiceNo = iNum
select SIMS_InvoiceNo;
}
but iNum at line 6 has a beautiful squiggly line, telling me I cannot convert type "char" to
"(corporatepath).Models.INVOICE".
Have I broken linq?
I have the class for invoice here: http://pastebin.com/da6PJxn6
Edit: I have also tried the double operator (==) which results in an error specifying that a single operator is to be used here.
Note: Changing the type of the column in SQL is not an option.