Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 20th, 2007, 03:22 AM
bsp bsp is offline
Registered User
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trying to insert Data in sqlsever from loginpage

   I am using a stored procedure,which first insert into usertable,then using userid as dealerid it will insert into dealertable,but when I am trying to config sqldatasource with this sp,it is showing insert fails as login can't be null.
My stored procedure is:

CREATE PROCEDURE sp_delinsert(@Login varchar(64) , @Pwd varchar(32),@SQuest varchar(64),@SAns varchar(64),@DealerID int,
    @Name varchar(128) ,
    @Addr1 varchar(128),
    @Addr2 varchar(64) ,
    @Place varchar(64) ,
    @County varchar(64) ,
    @Country varchar(64) ,
    @Phone varchar(64) ,
    @Fax varchar(32) ,
    @Email varchar(64) ,
    @MCFName varchar(64) ,
    @MCLname varchar(64) ,
    @MCPhone varchar(32) ,
    @MCEmail varchar(64) ,
    @SCFName varchar(64),
    @SCLName varchar(64),
    @SCPhone varchar(32),
    @SCEmail varchar(64),
    @CreateDate datetime) AS

     declare @uid int
    Set @uid=(SELECT UserID from [CarBid].[dbo].[CB_TblUsers])
           If @uid IS NULL


declare @userid int ,@UType int

INSERT INTO [CarBid].[dbo].[CB_TblUsers]([Login] ,[Pwd] ,[SQuest] ,[SAns] ,[UType] )

Set @userid =(Select UserID from [CarBid].[dbo].[CB_TblUsers] where UType='3')

INSERT INTO [CarBid].[dbo].[CB_TblDealer]([DealerID],[Name]
           ,[CreateDate] )
           ,@Name ,@Addr1
           ,@Email ,@MCFName
           ,@CreateDate )

DROP PROCEDURE sp_delinsert.
Pls suggest me its very urgent for my job.
Old March 20th, 2007, 07:03 AM
Friend of Wrox
Join Date: Sep 2004
Posts: 140
Thanks: 0
Thanked 0 Times in 0 Posts

Hey 3 things
1) What happens if the userid is not null?
2) why u drop the SP?
3) Do u have a prob with sp or dotnet connection ? try run the sp on sql to chk

Old March 20th, 2007, 09:45 AM
Authorized User
Join Date: Dec 2006
Posts: 36
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via Yahoo to deb1980


I think you should first check the SP running in the Query analyzer before you start executing that in dotnet.

Best regards,

Old March 21st, 2007, 05:51 AM
bsp bsp is offline
Registered User
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Already executed it in SQLSERVER 2005 Managment studio.It's ruuning ok there,problem is occuring when trying config sqlDataSource.

Similar Threads
Thread Thread Starter Forum Replies Last Post
insert same data to another remo MySQL 2 July 20th, 2007 12:08 AM
Data is not refreshed after an insert TomTab ADO.NET 3 January 19th, 2006 12:24 AM
Help Please with my code to insert data shopgirl Classic ASP Databases 7 February 24th, 2004 01:58 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.