Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

no value given...

Last post 03-20-2008 9:54 AM by _::suhanna::_. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 03-19-2008 3:15 AM

    no value given...

     hi..
     

    im working with vb.net

    i got a few problem..can u guys help me out...

    1. can u all tell me

    whats wrong with my code

     Public Sub UpdateMember(ByVal membername As String, ByVal address As String, ByVal handphone As String)


            ExecuteSqlCommand("update member set tmembername=" & membername & " taddress='" & address & "' and handphone='" & handphone & "'")

        End Sub

     

    when i running this error msg will out..

    "No value given for one or more required paremeters"

    please help me..im in urgent..

    thanks...
     

    • Post Points: 10
  • 03-19-2008 3:55 AM In reply to

    • CFQüeb
    • Top 500 Contributor
    • Joined on 04-27-2007
    • Mexico
    • Member
    • Points 275

    Re: no value given...

    Hi,

     The correct sintax of TSQL Update command is:

    UPDATE tablename SET field1=value1, field2=value2, field3=value3, fieldN=valueN WHERE condition

    First...

    You are missing the commas (,) character like a separator between fields and values.

    Second...

    You are using a clause AND without WHERE and CONDITION.

    Third...

    You must to place a character (') before and after each string field.

    Like this:

    ExecuteSqlCommand("UPDATE member SET tmembername ='" & membername & "'," & "taddress='" & address & "',"........etc)

    I recommend to you use stored procedures to manipulate the data into a database.

    Regards

    • Post Points: 10
  • 03-19-2008 4:14 AM In reply to

    Re: no value given...

     hiii..

    thanks for helping me..but its still got error..

      Public Sub UpdateMember(ByVal membername As String, ByVal address As String, ByVal handphone As String)

            ExecuteSqlCommand("update member set tmembername='" & membername & "'," & " taddress='" & address & "', and handphone='" & handphone & "'")

         
        End Sub

    and error msg is..."Syntax error in UPDATE statements"

    actually i dont know vb.net very well.

    thanks
     

    • Post Points: 15
  • 03-19-2008 5:05 AM In reply to

    • trafeeque
    • Top 50 Contributor
    • Joined on 10-26-2005
    • Guru
    • Points 2,700

    Re: no value given...

    write like this

     ExecuteSqlCommand("update member set tmembername='" & membername & "',taddress='" & address & "', handphone='" & handphone & "'")

     


    • Post Points: 10
  • 03-19-2008 5:31 AM In reply to

    • CFQüeb
    • Top 500 Contributor
    • Joined on 04-27-2007
    • Mexico
    • Member
    • Points 275

    Re: no value given...

    You MUST to remove the and statement from address & "', and  handphone

    • Post Points: 10
  • 03-19-2008 6:59 AM In reply to

    Re: no value given...

    i can update...

    but...

    all the data in member table also update..let say i have 5 data in table member...

    i want update data no 4..

    but after i press update then all the data becomes like no 4.

    i think i should put WHERE statements rite?
     

    • Post Points: 5
  • 03-20-2008 9:54 AM In reply to

    Re: no value given...

     hello u guys...

    thanks for helping me...

    im done now..sorry for the late reply..

    thanks again..

    • Post Points: 5
Page 1 of 1 (7 items)