0

I've created an SQL database within visual studio, now when trying to insert values from the web app into the database, within my insert statement, I obviously have to convert the textbox strings to the data type of that in the database. How?

  protected void Button1_Click(object sender, EventArgs e)
    {
        DataSet1TableAdapters.TableBookTableAdapter bookTableAdapter;
        bookTableAdapter = new DataSet1TableAdapters.TableBookTableAdapter();



        bookTableAdapter.Insert(ISBN: txtISBN.Text, courseID: txtCourseID.Text, bookTitle: txtBookTitle.Text, Ancillary: txtAncillary.Text,
            bookActive: true, ActiveDate: activeCalendar.SelectedDate, InactiveDate: inactiveCalendar.SelectedDate, Author: txtAuthor.Text, Imprint: txtImprint.Text, 
            Publisher: txtPublisher.Text, EditionDate: txtEditionDate.Text, VendorISBN: txtVendorISBN.Text, p1: txtP1.Text, eBookAvailable: true, eISBN: txtEISBN.Text, Notes: txtNotes.Text);

The error I get is no more than "Cannot convert from "string" to "int", Ive tried to convert it with what i've found online and cannot seem to come up with anything that works

    protected void Page_Load(object sender, EventArgs e)
    {
        int anInteger;
        anInteger = Convert.ToInt32(txtVendorISBN.Text);
        anInteger = int.Parse(txtVendorISBN.Text);
    }

Above is What I tried on page load to convert the information within the textbox to int but the syntax error still states that it cannot convert from string to int.

0 Answers0