update querry

  • hi all new to access as doing it with a mate i'm trying to update a tbl in access and my querry dosen't work so any help if i've gone wrong would be great. I think thought it might be the way he's set the properties in the DB columns

    my code

    con = New OleDbConnection(constring)

    cmd = New OleDBCommand ("UPDATE tblServerInfo SET ServerIP_FE =?,ServerIP_BE = ?," & _

    "ServerComment = ? WHERE Servername = ? ", con)

    cmd.paremter.addwithvalue(ServerIP_FE,tblServerIP_FE.text)

    cmd.paremter.addwithvalue(ServerIP_BE,tblServerIP_BE.text)

    cmd.paremter.addwithvalue(ServerComment,tblServerComment.text)

    cmd.executenonQuerry()

    If a null value needs to be added to one of the fields would this be possible the Querry i have created as this needs to happen, also is the querry ok 😀

    again thanks

  • I'm not that familiar with VB.Net and ADO.Net but:

    1. replace all occurrences of "paremeter" with "parameter"

    2. replace all occurrences of "querry" with "query"

    The SQL syntax looks correct, provided that parameters that go in are valid and of the correct type. Another way of testing this would be to build the SQL string in a variable then display it in your application so you can test it.

  • cheer for the reply my spelling might have been a bit rubish as i was a bit dopped up on pain killer after an op and i posted the question in hospital. However have got it working fine now after a bit of tinkering with the db cheers 😀

    i also missed out a parameter out for servername

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply