J# noob :-p, How 2 submit a form

Hi !

I'm new to J# and now i have a question.

I've made a form with some textfields en some buttons below it. Now I would like to have that with a click on a butten it submits the information into my database.

What is de code behind the button

TNX !

Willem




Answer this question

J# noob :-p, How 2 submit a form

  • FMW

    Hi there !

    I've now made a very simple program (in J#). It makes a connection with my MS Access database, it reads the data in it but won't save the data to it.

    This is de code behind the button, is there maybe something I forgot

    private void bEVE_complexBindingNavigatorSaveItem_Click(Object sender, System.EventArgs e)
    {
    this.Validate();
    this.bEVE_complexBindingSource.EndEdit();
    this.dataSetComplexBEVE_complexTableAdapter.Update(this.dataSetComplex.get_BEVE_complex());}

    grtz,

    Willem



  • Mart10

    Following is the sample; add it to button click event handler by replacing the highlighted with appropriate values


    private void button1_Click(Object sender, System.EventArgs e)
    {
     String connectString = "Data Source=<DBServer_name>;Initial Catalog=<DBName>;Integrated Security=True");

     SqlConnection objSqlConnection = new SqlConnection();
     objSqlConnection.set_ConnectionString(connectString);
     objSqlConnection.Open();
     SqlCommand objSqlCommand = new SqlCommand(<SQL_Command>, objSqlConnection);
     objSqlCommand.ExecuteNonQuery();
     objSqlConnection.Close();

    }


    Make sure to import System.Data.SqlClient.* package.

    Neela 



  • JLG

    Tnx for the answer !

    Only i'm working with MS Access 2003, so the connectionstring must be different I guess... can you tell me how it has to be, or is it still good

    Willem



  • minimalistic

    Please refer msdn documenation.

  • J# noob :-p, How 2 submit a form