473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Solve this and replay me i hunged here

Expand|Select|Wrap|Line Numbers
  1. Imports System.Data.SqlClient
  2. Namespace Accounts
  3.     Public Class NewAccount
  4.         Dim cmd As New SqlCommand
  5.         Dim c As New DatabaseConnection.DataBaseConnaction.ConnectionClass
  6.         Function CreateAccount(ByVal BankID As String, ByVal Account_TypeID As String, ByVal First_Name As String, ByVal Last_Name As String, ByVal Date_Birth As DateTime, ByVal Citizenship As String, ByVal Civil_Id As Integer, ByVal address As String, ByVal Father_Name As String, ByVal Profession As String, ByVal Description As String, ByVal Date_creation As DateTime, ByVal phoneNo As String, ByVal emailid As String, ByVal ext As String, ByVal CreatedBy As String, ByVal UserID As String)
  7.             Try
  8.                 cmd.Parameters.Add("@BankID", SqlDbType.VarChar)
  9.                 cmd.Parameters.Item("@BankID").Value = BankID
  10.  
  11.                 cmd.Parameters.Add("@Account_TypeID", SqlDbType.VarChar)
  12.                 cmd.Parameters.Item("@Account_TypeID").Value = Account_TypeID
  13.  
  14.                 cmd.Parameters.Add("@First_Name", SqlDbType.VarChar)
  15.                 cmd.Parameters.Item("@First_Name").Value = First_Name
  16.  
  17.                 cmd.Parameters.Add("@Last_Name", SqlDbType.VarChar)
  18.                 cmd.Parameters.Item("@Last_Name").Value = Last_Name
  19.  
  20.                 cmd.Parameters.Add("@Date_Birth", SqlDbType.DateTime)
  21.                 cmd.Parameters.Item("@Date_Birth").Value = Date_Birth
  22.  
  23.                 cmd.Parameters.Add("@Citizenship", SqlDbType.VarChar)
  24.                 cmd.Parameters.Item("@Citizenship").Value = Citizenship
  25.  
  26.                 cmd.Parameters.Add("@Civil_Id", SqlDbType.Int)
  27.                 cmd.Parameters.Item("@Civil_Id").Value = Civil_Id
  28.  
  29.                 cmd.Parameters.Add("@Address", SqlDbType.VarChar)
  30.                 cmd.Parameters.Item("@Address").Value = address
  31.  
  32.                 cmd.Parameters.Add("@Father_Name", SqlDbType.VarChar)
  33.                 cmd.Parameters.Item("@Father_Name").Value = Father_Name
  34.  
  35.                 cmd.Parameters.Add("@Profession", SqlDbType.VarChar)
  36.                 cmd.Parameters.Item("@Profession").Value = Profession
  37.  
  38.                 cmd.Parameters.Add("@phoneNo", SqlDbType.VarChar)
  39.                 cmd.Parameters.Item("@phoneNo").Value = phoneNo
  40.  
  41.                 cmd.Parameters.Add("@emailid", SqlDbType.VarChar)
  42.                 cmd.Parameters.Item("@emailid").Value = emailid
  43.  
  44.                 cmd.Parameters.Add("@Ext", SqlDbType.VarChar)
  45.                 cmd.Parameters.Item("@Ext").Value = ext
  46.  
  47.                 cmd.Parameters.Add("@Description", SqlDbType.VarChar)
  48.                 cmd.Parameters.Item("@Description").Value = Description
  49.  
  50.                 cmd.Parameters.Add("@Date_creation", SqlDbType.DateTime)
  51.                 cmd.Parameters.Item("@Date_creation").Value = Date.Now
  52.  
  53.                 cmd.Parameters.Add("@CreatedBy", SqlDbType.VarChar)
  54.                 cmd.Parameters.Item("@CreatedBy").Value = CreatedBy
  55.  
  56.                 cmd.Parameters.Add("@UserID", SqlDbType.VarChar)
  57.                 cmd.Parameters.Item("@UserID").Value = UserID
  58.  
  59.                 cmd.CommandType = CommandType.StoredProcedure
  60.                 cmd.CommandText = "Execute_Account2"
  61.  
  62.                 Dim QueryExecute As New DatabaseConnection.DataBaseConnaction.ConnectionClass
  63.                 QueryExecute.ExecuteNonquery(cmd)
  64.                 Return "New Account has been successully added"
  65.             Catch ex As Exception
  66.  
  67.                 Return "Error"
  68.  
  69.             End Try
  70.         End Function
  71.  
  72.     End Class
  73.  
  74. End Namespace
  75.  

I am geeting the Error pls any one sole this
Nov 6 '08 #1
4 1516
numberwhun
3,509 Expert Mod 2GB
Next time....

1. Please use code tags.
2. Please post questions in their appropriate forum, and not the introductions forum.

Regards,

Jeff
Moderator
Nov 6 '08 #2
ALTER PROCEDURE [dbo].[InsertAccount]

@BankID AS VARCHAR(500) ,
@Account_TypeID AS VARCHAR(500) ,
@First_Name AS VARCHAR(500) ,
@Last_Name AS VARCHAR(500) ,
@Date_Birth AS DATETIME ,
@Citizenship AS VARCHAR(500) ,
@Civil_Id AS BIGINT ,
@Address AS VARCHAR(500) ,
@Father_Name AS VARCHAR(500) ,
@Profession AS VARCHAR(500) ,
@phoneNo varchar(500) ,
@emailid varchar(500) ,
@Ext varchar(50) ,
@Description AS VARCHAR(500) ,
@Date_creation AS DATETIME ,
@CreatedBy AS VARCHAR(500) ,
@UserID AS VARCHAR(500)


AS
BEGIN

------------Account Number genaration-----------
DECLARE @Account_Number AS VARCHAR(500) ;
-- DECLARE @AccountTypeID AS VARCHAR(500) ;
---- SELECT @Location=BankLocation FROM Bank WHERE BankID=@BankID
---- SELECT @AccountTypeID=AccountTypeID FROM AccountTypes WHERE AccountTypeID=@Account_TypeID
IF @Account_TypeID='SB'
BEGIN
IF @BankID='NBKFAR01'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '101' AND '75000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=101
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE IF @BankID='NBKMIR01'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '75001' AND '150000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=75001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE IF @BankID='NBKSRK01'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '150001' AND '225000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=150001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE IF @BankID='NBKSRK02'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '225001' AND '300000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=225001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE
BEGIN
RAISERROR('Invalid Information',18,3)
END
END
ELSE IF @Account_TypeID='AC'
BEGIN
IF @BankID='NBKFAR01'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '2000001' AND '2075000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=2000001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE IF @BankID='NBKMIR01'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '2075001' AND '2150000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=2075001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE IF @BankID='NBKSRK01'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '2150001' AND '2225000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=2150001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE IF @BankID='NBKSRK02'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '2225001' AND '2300000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=2225001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE
BEGIN
RAISERROR('Invalid Information',18,3)
END
END
ELSE IF @Account_TypeID='FIX'
BEGIN
IF @BankID='NBKFAR01'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '5000001' AND '5075000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=5000001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE IF @BankID='NBKMIR01'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '5075001' AND '5150000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=5075001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE IF @BankID='NBKSRK01'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '5150001' AND '5225000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=5150001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE IF @BankID='NBKSRK02'
BEGIN
SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '5225001' AND '5300000'
IF @Account_Number IS NULL
BEGIN
SELECT @Account_Number=5225001
END
ELSE
BEGIN
SELECT @Account_Number=@Account_Number+1
END
END
ELSE
BEGIN
RAISERROR('Invalid Information',18,3)
END
END


INSERT INTO AccountDetails
(
Account_Number ,
BankID ,
Account_TypeID ,
First_Name ,
Last_Name ,
Date_Birth ,
Citizenship ,
Civil_Id ,
Address ,
Father_Name ,
Profession ,
Date_creation ,
phoneNo ,
emailid ,
Ext ,
Description ,
CreatedBy ,
UserID

)
VALUES
(
@Account_Number ,
@BankID ,
@Account_TypeID ,
@First_Name ,
@Last_Name ,
@Date_Birth ,
@Citizenship ,
@Civil_Id ,
@Address ,
@Father_Name ,
@Profession ,
@Date_creation ,
@phoneNo ,
@emailid ,
@Ext ,
@Description ,
@CreatedBy ,
@UserID
)


END

Dear All
i'm using this code to insert a record, but wen i'm using wrong data that time i'm not able to retrivew Error msg please replay me.
nazim
Dec 31 '08 #3
  1. ALTER PROCEDURE [dbo].[InsertAccount]

    @BankID AS VARCHAR(500) ,
    @Account_TypeID AS VARCHAR(500) ,
    @First_Name AS VARCHAR(500) ,
    @Last_Name AS VARCHAR(500) ,
    @Date_Birth AS DATETIME ,
    @Citizenship AS VARCHAR(500) ,
    @Civil_Id AS BIGINT ,
    @Address AS VARCHAR(500) ,
    @Father_Name AS VARCHAR(500) ,
    @Profession AS VARCHAR(500) ,
    @phoneNo varchar(500) ,
    @emailid varchar(500) ,
    @Ext varchar(50) ,
    @Description AS VARCHAR(500) ,
    @Date_creation AS DATETIME ,
    @CreatedBy AS VARCHAR(500) ,
    @UserID AS VARCHAR(500)


    AS
    BEGIN

    ------------Account Number genaration-----------
    DECLARE @Account_Number AS VARCHAR(500) ;
    -- DECLARE @AccountTypeID AS VARCHAR(500) ;
    ---- SELECT @Location=BankLocation FROM Bank WHERE BankID=@BankID
    ---- SELECT @AccountTypeID=AccountTypeID FROM AccountTypes WHERE AccountTypeID=@Account_TypeID
    IF @Account_TypeID='SB'
    BEGIN
    IF @BankID='NBKFAR01'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '101' AND '75000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=101
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE IF @BankID='NBKMIR01'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '75001' AND '150000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=75001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE IF @BankID='NBKSRK01'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '150001' AND '225000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=150001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE IF @BankID='NBKSRK02'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '225001' AND '300000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=225001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE
    BEGIN
    RAISERROR('Invalid Information',18,3)
    END
    END
    ELSE IF @Account_TypeID='AC'
    BEGIN
    IF @BankID='NBKFAR01'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '2000001' AND '2075000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=2000001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE IF @BankID='NBKMIR01'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '2075001' AND '2150000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=2075001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE IF @BankID='NBKSRK01'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '2150001' AND '2225000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=2150001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE IF @BankID='NBKSRK02'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '2225001' AND '2300000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=2225001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE
    BEGIN
    RAISERROR('Invalid Information',18,3)
    END
    END
    ELSE IF @Account_TypeID='FIX'
    BEGIN
    IF @BankID='NBKFAR01'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '5000001' AND '5075000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=5000001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE IF @BankID='NBKMIR01'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '5075001' AND '5150000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=5075001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE IF @BankID='NBKSRK01'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '5150001' AND '5225000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=5150001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE IF @BankID='NBKSRK02'
    BEGIN
    SELECT @Account_Number=MAX(Account_Number) FROM AccountDetails WHERE Account_Number BETWEEN '5225001' AND '5300000'
    IF @Account_Number IS NULL
    BEGIN
    SELECT @Account_Number=5225001
    END
    ELSE
    BEGIN
    SELECT @Account_Number=@Account_Number+1
    END
    END
    ELSE
    BEGIN
    RAISERROR('Invalid Information',18,3)
    END
    END


    INSERT INTO AccountDetails
    (
    Account_Number ,
    BankID ,
    Account_TypeID ,
    First_Name ,
    Last_Name ,
    Date_Birth ,
    Citizenship ,
    Civil_Id ,
    Address ,
    Father_Name ,
    Profession ,
    Date_creation ,
    phoneNo ,
    emailid ,
    Ext ,
    Description ,
    CreatedBy ,
    UserID

    )
    VALUES
    (
    @Account_Number ,
    @BankID ,
    @Account_TypeID ,
    @First_Name ,
    @Last_Name ,
    @Date_Birth ,
    @Citizenship ,
    @Civil_Id ,
    @Address ,
    @Father_Name ,
    @Profession ,
    @Date_creation ,
    @phoneNo ,
    @emailid ,
    @Ext ,
    @Description ,
    @CreatedBy ,
    @UserID
    )


    END

    Dear All
    i'm using this code to insert a record, but wen i'm using wrong data that time i'm not able to retrivew Error msg please replay me.
    nazim[/quote]
Dec 31 '08 #4
i'm not able to retriew Error mg
@nazimsal
Dec 31 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Sharone Shani | last post by:
Hi John, thanks for your replay. What I'm trying to do is as follows: We are hosting a server, which is used by our clients. We have a printing object written in Visual Basic.NET. I want to...
2
by: zak | last post by:
I have some testing to do and I need to put a whole set of data in I want to Record and replay in a loop keystrokes. An idea
1
by: newcomer | last post by:
I have traced action in XML. Now I would like to replay that. How could I do that based on this XML trace? I am using soap:tcp between client and server. thanks,
3
by: Baheri | last post by:
Does any one have a sample on how can replay attacks be prevented in a webservice?
0
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool...
2
by: Derrick | last post by:
Can anyone suggest a tool (if one exists) to capture IIS traffic and be able to "replay" that traffic? We are in the process of moving from sql2k to sql2005. What I would like to do is take a...
3
by: phanimadhav | last post by:
Actually i am new one of this ASP.NET.i have have one problem with session_end() in Global.aspx.when this session_end() is faired. I call the session.abandon() method.but my requirement is whenever i...
7
by: Lew | last post by:
Hi, I'm looking for a tool that can capture all the sql transactions for a period of time (24 hours or so ) from our production server and replay it exactly as entered on our performance tuning...
1
by: Gomi | last post by:
Hi guys I'm new to C++ Programming and I am having trouble in making my Guessing game code replay. I am suppose to give the user that is playing my game the opportunity to play again with options of...
5
by: hany1002 | last post by:
I design stores database and I have a problem I maked Invoices for the purchase and sale, I need to transfer Items between Branches in my store access database ? Any Ideas thank you
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.