![Quote](images/metro/blue/misc/quote_icon.png)
Originally Posted by
skeptic_rob
OleDbCommand cmd = new OleDbCommand("INSERT INTO Reservation values (" +' '+"'" + this.TextBox1.Text + "','" + this.TextBox7.Text + "','" + this.TextBox3.Text + "','" + this.TextBox4.Text + "','" + this.TextBox5.Text + "','" + this.TextBox6.Text + "')", conn);
mo auto increment taha cya ba sa textbox ....no idea at all
in ani ako g code sa button
int i = 0
i = i + 1;
text1.text = "" + i; mao ra g hapon dli mo ganha i need ur assistance mga expert
Never tested on this but try something like this:
C#:
protected void Button1_Click(object sender, EventArgs e){
int sum = int.Parse(TextBox1.Text.Trim()) + 1;
TextBox1.Text = sum.ToString();
}
VB.NET:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim sum As Integer = Integer.Parse(TextBox1.Text.Trim()) + 1
TextBox1.Text = sum.ToString()
End Sub
This will increment the value of your TextBox to 1 everytime you clicked on the Button.
Important note:
Also, I will not recommend you to append the values directly into your SQL statements especially when doing inserts because that would leads you to
SQL Injection , use
Parameterized Query instead for security..