Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)

  • RE: Inserting values with SP

    GilaMonster (3/18/2014)


    Insert a new row?

    So, if the user selects all 25 columns one by one, then you want to have 25 separate rows in the database table, each with a...

  • RE: Inserting values with SP

    Wenn I click the item 'User Name' from the listbox(assigned to the Textbox), I want to insert a value into the 'user_name' column in the DB. That's all. I have...

  • RE: Inserting values with SP

    use env

    go

    create proc [SP$insert2](

    @p1 nvarchar(100),

    @p2 nvarchar(100),

    @id int output

    )

    as

    begin

    set nocount on

    INSERT INTO env.dbo.Base(user_name) VALUES (@p1)

    SELECT @id = SCOPE_IDENTITY()

    SELECT @p2

    WHERE @p2 = 'User Name'

    INSERT INTO env.dbo.Base(ser_num) VALUES (@p1)

    SELECT @id=...

  • RE: Inserting values with SP

    GilaMonster (3/17/2014)


    And when you run the proc from SQL as I suggested?

    Those are compile-time warnings, not interested in compile-time messages, interested in the run-time errors (if any) from SQL Server.

    That's...

  • RE: Inserting values with SP

    Sean Lange (3/17/2014)


    You could greatly simplify this proc and remove about 40% of the lines which don't really provide anything.

    create proc [SP$insert]

    (

    @p1 nvarchar(100),

    @p2 nvarchar(100),

    @id int output

    )

    as

    set nocount on

    select @p2...

  • RE: Inserting values with SP

    Sean Lange (3/17/2014)


    altana (3/17/2014)


    It still works same.

    How do you know that the users are entering the right values in your textbox?

    Your C# code is passing the value from a textbox...

  • RE: Inserting values with SP

    GilaMonster (3/17/2014)


    Remove the error handling (database side and client side, since both hide the errors) and have a look at exactly what is being returned

    Also try running the stored proc...

  • RE: Inserting values with SP

    GilaMonster (3/17/2014)


    What error are you getting?

    Nothing. The message is 'Inserted' but any values can be inserted.

  • RE: Inserting values with SP

    It still works same.

  • RE: Inserting values with SP

    GilaMonster (3/17/2014)


    What errors are you getting?

    p.s. A catch block which just discards the error is not exactly good coding practice.

    I doesn't give any error. The message is 'Inserted' but the...

  • RE: Inserting values with SP

    Adi Cohn-120898 (3/17/2014)


    Could be that you had the wrong value in @p2, so the flow did not get inside the if statement.

    Adi

    No, it's the right value. Wenn I insert only...

Viewing 11 posts - 1 through 11 (of 11 total)