dim a as double dim b as double dim result as double If Not Double.TryParse(KMTextBox.Text, A) Then MessageBox.Show("INVALID") Else If Not Double.TryParse(KFTextBox.Text, B) Then MessageBox.Show("INVALID") Else result = A + B KTTextBox.Text = result.ToString("") End If End If
Try Dim sqlconn As New OleDb.OleDbConnection Dim sqlquery As New OleDb.OleDbCommand connstring = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Planz.mdb" sqlconn.ConnectionString = connstring sqlquery.Connection = sqlconn sqlconn.Open() sqlquery.CommandText = "INSERT INTO Table1 ([KM],[KF],[KT]) Values (@KM,@KF,@KT)" sqlquery.Parameters.AddWithValue("@KM", KMTextBox.Text) sqlquery.Parameters.AddWithValue("@KF", KFTextBox.Text) sqlquery.Parameters.AddWithValue("@KT", KTTextBox.Text) sqlquery.ExecuteNonQuery() sqlconn.Close() Table1TableAdapter.Fill(PlanzDataSet.Table1) Table1DataGridView.Update() MessageBox.Show("Record Added") Update() Catch ex As Exception MessageBox.Show(ex.Message) End Try
Public Class ...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)