I am working with Microsoft SQL Server Management Studio, and C# .net
My code fetches string data from the webBrowser, stores it in a textbox, compares it with values in my database, and gets the corresponding int ID to that string. Now, this int ID is displayed in a textbox (optional), and is then stored in another table in my database.
My code is as follows:
string p = dComm.executeScalar("select StateID from StateMaster where StateCode='" + txtState.Text + "'");
textBox1.Text = p;
Convert.ToInt32(p);
This fetches the StateID, and displays it in a textbox. I then open another table from the database, and put the value as shown below.
dTbl = dComm.openDataTable("CompanyMaster", "select * from CompanyMaster where 1=0 ");
DataRow dRow;
dRow = dTbl.NewRow();
dRow["StateID"] = p;
Now, this code works perfectly fine when i run the code on the HTML file of the page, but if I try to run it directly from the web browser, it gives an error
Input String was not in a correct format
The error is shown at the line:
Convert.ToInt32(p);
Am I missing something? Can anyone help me with this?
pis.running through HTML codevs.directly from the browser?