Page Design
Store Procedure For Multipledata (At a time 2 ta table re data insert heba gote )
ALTER PROCEDURE [linku].[Satyabrata]
(
@Formula_Name VARCHAR(50)=NULL,
@Parameter Inventory.D_Formula READONLY
)
AS
BEGIN
INSERT INTO Inventory.D_ItemFormula
(Formula_Name ,Created_On
)
VALUES(@Formula_Name, GETDATE() )
DECLARE @Out INT
SET @Out=SCOPE_IDENTITY()
INSERT INTO Inventory.D_ItemFormulaDetails
(Formula_ID,Field_ID,Type)
SELECT @Out,
Field_ID,
Type
FROM @Parameter
END
====================
How to declare a Type IN Sql
CREATE TYPE Inventory.D_Formula AS
TABLE
(
Field_ID INT NULL,
Type VarChar(50)=NULL
)
GO
=========================
In object Layer we can just Add This
public DataTable DataFormula
{
get;
set;
}
===============================================
DataTable dtformula;
void CreateDatatable()
{
dtformula = new DataTable();
dtformula.Columns.Add("FieldID", typeof(int));
dtformula.Columns.Add("Type", typeof(string));
}
private void BtnSave_Click(object sender, EventArgs e)
{
if (Checkdata()==true)
{
SaveFormula();
}
}
void SaveFormula()
{
Satya objformula = new Satya();
objformula.FormulaName = TxtFormulaName.Text.Trim();
objformula.DataFormula = dtformula;
ERPManagement.GetInstance.InsertFormula(objformula);
MessageBox.Show("Data Saved Successfully.", "Kencloud", MessageBoxButtons.OK, MessageBoxIcon.Information);
Reset();
}
No comments:
Post a Comment