![]() GvDecimalValues.EditIndex = e.NewEditIndex Protected Sub OnRowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Protected Sub Save(ByVal sender As Object, ByVal e As EventArgs)ĭim con As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("constr").ConnectionString)ĭim cmd As SqlCommand = New SqlCommand("INSERT INTO Testdt Convert.ToDecimal(txtNumber.Text))ĭim cmd As SqlCommand = New SqlCommand("SELECT * FROM Testdt", con)ĭim da As SqlDataAdapter = New SqlDataAdapter(cmd) VB.Net Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Protected void OnRowCancelingEdit(object sender, EventArgs e) Using (SqlConnection con = new SqlConnection(constr)) String query = "UPDATE Testdt SET WHERE constr = String value = (row.FindControl("txtValue") as TextBox).Text Protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e) Protected void OnRowEditing(object sender, GridViewEditEventArgs e) SqlDataAdapter da = new SqlDataAdapter(cmd) SqlCommand cmd = new SqlCommand("SELECT * FROM Testdt", con) SqlCommand cmd = new SqlCommand("INSERT INTO Testdt Convert.ToDecimal(txtNumber.Text)) Protected void Save(object sender, EventArgs e) This looks the database: INT IDENTITY (1, 1) NOT NULL,Ĭ# protected void Page_Load(object sender, EventArgs e) ![]() LblSuccessMessage.Text = "Actualizat cu succes!" SqlCommand cmd = new SqlCommand(sql, sqlCon) String sql = "UPDATE Venituri SET Denumire='" + tbDenumire.Text + "',Data='" + tbData.Text + "',Descriere='" + tbDescriere.Text + "',Suma='" + Convert.ToDecimal(tbSuma.Text) + "' WHERE VenitId=" + VenitId + "" TextBox tbDescriere = (TextBox)("tbDescriere") TextBox tbDenumire = (TextBox)("tbDenumire") ![]() SqlConnection sqlCon = new SqlConnection(CS) How to resolve this convertion? protected void GridViewIncomes_RowUpdating(object sender, GridViewUpdateEventArgs e) In db the type is decimal(10,2), I convert it to decimal when it updated but does not work. Error converting data type varchar to numeric.
0 Comments
Leave a Reply. |