bftarane
جمعه 08 دی 1391, 12:10 عصر
سلام من sp زير رو دارم يعني مي خوام در سه جدول همزمان درج انجام بدم که بين دو تا از اين جدول ها Relation وجود داره
USE [st]
GO
/****** Object: StoredProcedure [dbo].[CreatePage] Script Date: 12/28/2012 11:27:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[CreatePage]
(
@Contents ntext,
@kewords ntext,
@description nvarchar(max),
@CategoryId int,
@metaID int
)
as
begin
begin transaction
insert into tbl_newpage (Contents,CategoryId)values(@Contents,@CategoryID)
insert into tbl_meta (keywords,description) values(@kewords,@description)
set @metaID=SCOPE_IDENTITY()
insert into tbl_MenuMata(CategoryId,metaID) values(@CategoryId,@metaID)
commit transaction
end
و انتظار دارم metaID به طور خودکار درج بشه در جدول tbl_MenuMeta بدون اينکه من خارج از Sp، به meta@ مقدار بدم ولي در برنامم (من با Asp.net و C#) کار مي کنم به من اين پيغام رو ميده
Procedure or function 'CreatePage' expects parameter '@metaID', which was not supplied.
اينم کدهاي من
public void CreateNewPage()
{
try
{
Convert.ToInt32(MyDALBase.ExecuteScaler(System.Dat a.CommandType.StoredProcedure, "CreatePage", new SqlParameter[]{
new SqlParameter("@Contents",FreeTextBox2.Text),
new SqlParameter("@CategoryID", ViewState["Id"]),
new SqlParameter("@kewords",tkey.Text),
new SqlParameter("@description",tdesc.Text)
}));
MultiView1.ActiveViewIndex = 5;
}
catch (Exception)
{
throw;
//MultiView1.ActiveViewIndex=6;
}
}
خوب الآن من چطور ميتونم اين مشکل رو حل کنم؟
خيلي ممنون مي شم جواب بدين.
USE [st]
GO
/****** Object: StoredProcedure [dbo].[CreatePage] Script Date: 12/28/2012 11:27:44 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[CreatePage]
(
@Contents ntext,
@kewords ntext,
@description nvarchar(max),
@CategoryId int,
@metaID int
)
as
begin
begin transaction
insert into tbl_newpage (Contents,CategoryId)values(@Contents,@CategoryID)
insert into tbl_meta (keywords,description) values(@kewords,@description)
set @metaID=SCOPE_IDENTITY()
insert into tbl_MenuMata(CategoryId,metaID) values(@CategoryId,@metaID)
commit transaction
end
و انتظار دارم metaID به طور خودکار درج بشه در جدول tbl_MenuMeta بدون اينکه من خارج از Sp، به meta@ مقدار بدم ولي در برنامم (من با Asp.net و C#) کار مي کنم به من اين پيغام رو ميده
Procedure or function 'CreatePage' expects parameter '@metaID', which was not supplied.
اينم کدهاي من
public void CreateNewPage()
{
try
{
Convert.ToInt32(MyDALBase.ExecuteScaler(System.Dat a.CommandType.StoredProcedure, "CreatePage", new SqlParameter[]{
new SqlParameter("@Contents",FreeTextBox2.Text),
new SqlParameter("@CategoryID", ViewState["Id"]),
new SqlParameter("@kewords",tkey.Text),
new SqlParameter("@description",tdesc.Text)
}));
MultiView1.ActiveViewIndex = 5;
}
catch (Exception)
{
throw;
//MultiView1.ActiveViewIndex=6;
}
}
خوب الآن من چطور ميتونم اين مشکل رو حل کنم؟
خيلي ممنون مي شم جواب بدين.