问题描述
尊敬的先生,
我使用vb.net作为前端而sqlserver2008作为后端
和我使用存储过程发送数据。如下
Respected sir,
i am using vb.net as front end and sqlserver2008 as backend
and i m using stored procedure to send data. as follows
Dim param(10) As SqlParameter
param(0) = New SqlParameter("@Company_Name", _Company_Name)
param(1) = New SqlParameter("@Flat", _Flat)
param(2) = New SqlParameter("@Area", _Area)
param(3) = New SqlParameter("@Street", _Street)
param(4) = New SqlParameter("@City", _City)
param(5) = New SqlParameter("@State", _State)
param(6) = New SqlParameter("@Pin", _Pin)
param(7) = New SqlParameter("@Phone", _Phone)
param(8) = New SqlParameter("@Fax", _Fax)
param(9) = New SqlParameter("@E_Mail", _Email)
param(10) = New SqlParameter("@Web_Site", _Web)
objdal.ExecuteDatasetOnly("SP_I_Vendors", param)
和存储过程如下
and stored procedure as follows
alter PROC SP_I_Vendors
(
@Company_Name nvarchar(100),
@Flat nvarchar(30),
@Area nvarchar(30),
@Street nvarchar(30),
@City nvarchar(30),
@State nvarchar(30),
@Pin nvarchar(10),
@Phone nvarchar(20),
@Fax nvarchar(20),
@E_Mail nvarchar(30),
@Web_Site nvarchar(20),
@ContactPerson nvarchar(20)
)
AS
BEGIN
INSERT INTO Vendors
(
Company_Name,Flat,Area,Street,City,State,Pin,
Phone,Fax,E_Mail,Web_Site,ContactPerson,CreatedOn
)
VALUES
(
@Company_Name,@Flat,@Area,@Street,@City,@State,@Pin,
@Phone,@Fax,@E_Mail,@Web_Site,@ContactPerson,GETDATE()
)
end
但是我在前面遇到错误,
程序或函数SP_I_Vendors期望参数@Company_Name未提供
当我通过从sqlquery中删除第一列(@Company_Name)进行交叉检查时仍然得到相同的错误
过程或函数SP_I_Vendors期望参数@Flat未提供
表示第一个参数每次都显示错误..
我一直试图解决上述问题,但是2天但没有得到解决方案..
请帮帮我...
谢谢,
but i got error at front side that,
"Procedure or function SP_I_Vendors expect parameter @Company_Name which was not supplied"
when i cross check with removing first column(@Company_Name)from the sqlquery still i get same error with
"Procedure or function SP_I_Vendors expect parameter @Flat which was not supplied"
means first parameter shows error everytime..
I have been trying to solve above problem since 2 days but not getting solution..
Please help me...
Thank you,
推荐答案
USE [cpqaAnswers]
GO
CREATE TABLE [cpqa].[tbl_SB_Vendors](
Company_Name nvarchar(100),
Flat nvarchar(30),
Area nvarchar(30),
Street nvarchar(30),
City nvarchar(30),
State nvarchar(30),
Pin nvarchar(10),
Phone nvarchar(20),
Fax nvarchar(20),
E_Mail nvarchar(30),
Web_Site nvarchar(20),
ContactPerson nvarchar(20),
CreatedOn nvarchar(666)
)
CREATE PROC [cpqa].[sp_SB_SP_I_Vendors]
(
@Company_Name nvarchar(100),
@Flat nvarchar(30),
@Area nvarchar(30),
@Street nvarchar(30),
@City nvarchar(30),
@State nvarchar(30),
@Pin nvarchar(10),
@Phone nvarchar(20),
@Fax nvarchar(20),
@E_Mail nvarchar(30),
@Web_Site nvarchar(20),
@ContactPerson nvarchar(20),
@CreatedOn nvarchar(666)
)
AS
BEGIN
INSERT INTO [cpqa].[tbl_SB_Vendors]
(
Company_Name,Flat,Area,Street,City,[State],Pin,
Phone,Fax,E_Mail,Web_Site,ContactPerson,CreatedOn
)
VALUES
(
@Company_Name,@Flat,@Area,@Street,@City,@State,@Pin,
@Phone,@Fax,@E_Mail,@Web_Site,@ContactPerson,GETDATE()
)
end
EXECUTE [cpqa].[sp_SB_SP_I_Vendors] 'a', 'b', 'c', 'd' ,'e' ,'f', 'g', 'h', 'i', 'j' ,'k', 'l', 'm'
SELECT [Company_Name]
,[Flat]
,[Area]
,[Street]
,[City]
,[State]
,[Pin]
,[Phone]
,[Fax]
,[E_Mail]
,[Web_Site]
,[ContactPerson]
,[CreatedOn]
FROM [cpqaAnswers].[cpqa].[tbl_SB_Vendors]
GO
似乎工作,所以....
Seems to work, so ....
Company_Name Flat Area Street City State Pin Phone Fax E_Mail Web_Site ContactPerson CreatedOn
a b c d e f g h i j k l Oct 20 2013 2:43PM
这篇关于如何将sqlparameter从前端传递给sqlserver2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!