ALTER procedure [dbo].[sp_files]
@filename nvarchar(50),
@invID int,
@filepath nvarchar(max),
@filesize decimal,
@fileCreateddt datetime
as
begin
insert into [dbo].[tblFiles](fileName,invID,fileSize,filePath,fileCreatedDt) values(@filename,@invID,@filesize,@filepath,@fileCreateddt)
end
and C# code:-
private void button1_Click(object sender, EventArgs e) {
using (SqlConnection con = new SqlConnection(dc.Con)) {
using (SqlCommand cmd = new SqlCommand("storedprocedure", con)) {
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@filename", SqlDbType.VarChar).Value = txtFirstName.Text;
cmd.Parameters.Add("@invID", SqlDbType.VarChar).Value = txtLastName.Text;
con.Open();
cmd.ExecuteNonQuery();
}
}
}