Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Command Parameters

    Can someone tell me why the following code does not work ?

    It does not crash or cause errors and it creates a new row in the table
    "tblusers" but the fields are NULL.

    Sub doInsert()
    'Create Insert string
    Dim MySQL As String = "Insert into tblusers (USERTEXT) values (@Pnotes)"
    'Set up connection to mysql database
    Dim myConn As OdbcConnection = New
    OdbcConnection("driver={MySql};uid=root;pwd=;serve r=127.0.0.1;database=dbnrg
    plc;OPTION=17923")
    Dim Cmd As New OdbcCommand(MySQL, myConn)
    Cmd.Parameters.Add(New OdbcParameter("@Pnotes", Me.txtNotes.Text))
    myConn.Open()
    Cmd.ExecuteNonQuery()
    myConn.Close()
    End Sub

    Thanks in Advance


    Paul Guest

  2. Similar Questions and Discussions

    1. get command line parameters in plugin (i.e. argc & argv)
      hi, i'm searching in the api documentation how to get parameters passed to acrobat when i call c:\acrobat\acrobat.exe ___mypdf.pdf -C ashjs7...
    2. using Command to set Parameters and Recordset to retrive the Query
      Hi guys, withou using SP, I want to be able to add a Parameter to the SQL Query and retrive the Recordset so I can use the Paging property under...
    3. SPs/Command Object/Parameters Problem
      I've searched through google groups and cannot find an answer to this: My application passes values from a form to a page that requests them and...
    4. Projector with command line parameters
      Hello, is it possible to build a projector, which can be started with command line parameters? If yes, how can I get access to this parameters...
    5. Passing parameters to a Perl Script from Command Line (Linux)
      Hi, I'm fairly new to both programming in shell script (linux) and in programming in perl. I need to pass a parameter to the perl script from...
  3. #2

    Default Re: Command Parameters

    Paul,

    Run the debugger and see if the text box actually has a value in it.

    My guess is that your code is clearing the text box on post back.

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche
    "Paul" <paul@themedialounge.com> wrote in message
    news:udxTRUCXDHA.888@TK2MSFTNGP10.phx.gbl...
    > Can someone tell me why the following code does not work ?
    >
    > It does not crash or cause errors and it creates a new row in the table
    > "tblusers" but the fields are NULL.
    >
    > Sub doInsert()
    > 'Create Insert string
    > Dim MySQL As String = "Insert into tblusers (USERTEXT) values
    (@Pnotes)"
    > 'Set up connection to mysql database
    > Dim myConn As OdbcConnection = New
    >
    OdbcConnection("driver={MySql};uid=root;pwd=;serve r=127.0.0.1;database=dbnrg
    > plc;OPTION=17923")
    > Dim Cmd As New OdbcCommand(MySQL, myConn)
    > Cmd.Parameters.Add(New OdbcParameter("@Pnotes", Me.txtNotes.Text))
    > myConn.Open()
    > Cmd.ExecuteNonQuery()
    > myConn.Close()
    > End Sub
    >
    > Thanks in Advance
    >
    >

    S. Justin Gengo Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139