8 Replies - 922 Views - Last Post: 05 March 2015 - 09:40 AM

#1 RustyAMcM  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 192
  • Joined: 21-January 15

Select Replace SQL string

Posted 05 March 2015 - 07:27 AM

I need to be able to update a table in my database every pass until a column in the feed is filled i have everything worked out but the select replace string here is what I got:

"SELECT REPLACE [AutoUpdateTable] ([MachineID], [SerialNumb], [MachineType], [AreaLocation], [Line], [Model], [TimeInfo], " & _
                           "[DateStamp], [TimeStamp], [On], [Run], [Ready], [No_Material], [Maintenance], [ProgramInfo], " & _
                           "[Item], [AccountNumb], [Speed], [PlaceHolder], [OperatorInfo], [IDCode], [WorkTime], [Count], [PlaceHolder1], " & _
                           "[PlaceHolder2]) " & _
                           "VALUES (@MachineID, @SerialNumb, @MachineType, @AreaLocation, @Line, @Model, @TimeInfo, @DateStamp, @TimeStamp, @On, " & _
                           "@Run, @Ready, @No_Material, @Maintenance, @ProgramInfo, @Item, @AccountNumb, @Speed, @PlaceHolder, @OperatorInfo, " & _
                           "@IDCode, @WorkTime, @Count, @PlaceHolder1, @PlaceHolder2);"


Now I don't know much about sql but I do know that I have to include the parameters which are just below this line of text the error I am getting is : Syntax error (missing operator) in query expression 'REPLACE [AutoUpdateTable] ([MachineID], [SerialNumb], [MachineType], [AreaLocation], [Line], [Model], [TimeInfo], [DateStamp], [TimeStamp], [On], [Run], [Ready], [No_Material], [Maintenance], [ProgramInfo], [Item], [AccountNumb], [Speed], [PlaceHolder], ['.

Is This A Good Question/Topic? 0
  • +

Replies To: Select Replace SQL string

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13383
  • View blog
  • Posts: 53,409
  • Joined: 12-June 08

Re: Select Replace SQL string

Posted 05 March 2015 - 07:49 AM

Start wit the basics.

What database is this? Does that DB "select" or "replace" function as an "UPDATE" in said scheme?
Was This Post Helpful? 0
  • +
  • -

#3 RustyAMcM  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 192
  • Joined: 21-January 15

Re: Select Replace SQL string

Posted 05 March 2015 - 08:18 AM

This is an access 2010 database and I am not sure... if needed I can post full code if needed it is done in asp.net and vb.net on a web form I have been told I should use MVC instead but i need to have this in working order soon for some show the company is doing

View Postmodi123_1, on 05 March 2015 - 07:49 AM, said:

Start wit the basics.

What database is this? Does that DB "select" or "replace" function as an "UPDATE" in said scheme?



UPDATE might work but will update hold this number of parameters?
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13383
  • View blog
  • Posts: 53,409
  • Joined: 12-June 08

Re: Select Replace SQL string

Posted 05 March 2015 - 08:20 AM

If you want to update a row then UPDATE is what you need to use. It will hold as many columns as you need.

Side note - an Access DB backing a web form is a bad idea since Access is not multiuser/concurrent friendly.
Was This Post Helpful? 0
  • +
  • -

#5 djjeavons  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 114
  • View blog
  • Posts: 417
  • Joined: 09-January 09

Re: Select Replace SQL string

Posted 05 March 2015 - 08:24 AM

And just to add, an UPDATE statement is in the form:

UPDATE Table SET Field=Value, AnotherField=Value WHERE SomeField=Criteria



Your current statement resembles an INSERT INTO syntax which is not what you want.
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13383
  • View blog
  • Posts: 53,409
  • Joined: 12-June 08

Re: Select Replace SQL string

Posted 05 March 2015 - 08:27 AM

.. and the docs..
https://msdn.microso...fice.12%29.aspx
Was This Post Helpful? 0
  • +
  • -

#7 RustyAMcM  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 192
  • Joined: 21-January 15

Re: Select Replace SQL string

Posted 05 March 2015 - 08:54 AM

ok great thanks for the info I will check into this and let you know.

As for access backing a web form I know I am trying to talk them into using SQL or Something of the like but this is how they want it done for the moment I was told " we need to do this this way as a proof of concept, Then we can make the recommendations for what is really needed for what will be required" Sooo my hands are tied at this point but again thanks for the info.
Was This Post Helpful? 0
  • +
  • -

#8 djjeavons  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 114
  • View blog
  • Posts: 417
  • Joined: 09-January 09

Re: Select Replace SQL string

Posted 05 March 2015 - 09:01 AM

Nothing wrong with that approach, PoC's are supposed to be cheap. Only thing to watch out for is whether the powers that be expect the PoC to go into production. Nearly always, PoC's should be throw away pieces.
Was This Post Helpful? 0
  • +
  • -

#9 RustyAMcM  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 192
  • Joined: 21-January 15

Re: Select Replace SQL string

Posted 05 March 2015 - 09:40 AM

Modi,

This works great thanks again for the help
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1