create table products(product nvarchar(max), price numeric(18,2), discount numeric(18,2) default 0)
CREATE PROCEDURE sp1 @p1 NVARCHAR(MAX), @p2 NUMERIC(18,2), @p3 NUMERIC(18,2) default 0 AS BEGIN INSERT INTO products VALUES (@p1 ,@p2 ,@p3 ) End GO
com = New SqlCommand("sp1", con) com.CommandType = CommandType.StoredProcedure Try com.Parameters.AddWithValue("@p1", TextBox1.Text) com.Parameters.AddWithValue("@p2", TextBox2.Text) com.Parameters.AddWithValue("@p3", TextBox3.Text) com.ExecuteNonQuery() MsgBox("Record Added....") Catch ex As Exception MsgBox(ex.Message) End Try
... com.Parameters.AddWithValue("@p2", (TextBox2.Text.Trim().Length == 0 ? "0" : TextBox2.Text)) com.Parameters.AddWithValue("@p3", (TextBox3.Text.Trim().Length == 0 ? "0" : TextBox3.Text)) ...
NULL
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)