Consider the following: i have 4 textboxes which i want to use to insert data in my sql database.
My sql table is composed of 4 fields: name-varchar, description-varchar,year-integer,grade-varchar.
I have a button that will determine the new row to be added. But it doesn't work. I keep getting an error. Here is the code that i execute using the 5 texboxes:
com.CommandText = "insert into Table (name,description,year,grade) values( '"+textbox1.text.tostring+"','"+textbox2.text.tostring+ "',"+var(textbox3.text)+",'"textbox4.text.tostring"')
I guess the problem is when i try adding the value of textbox3, which has to be of type integer.
Trying to execute this command with a integer value for the year field inserted manually by me work just fine.
Therefore, how can i work this problem out? I need to insert values from textboxes, getting into the code for each new entry is not an option.