Link to home
Create AccountLog in
Avatar of dwelx
dwelx

asked on

Query string to update tables

I am programing in VB6 and this is a postgreSQL db.

Below is the 2 tables that are setup in the db.

tblvrdata
vr_city - character varying(primary key) - 297 rows - Never Changes
vr_location - character varying - Never Changes
vr_search - character varying - Never Changes
vr_ltoken - character varying - Never Changes
vr_id - bigint
vr_email - character varying
vr_fname - character varying
vr_lastloc - character varying
vr_midtitle - character varying
vr_p - smallint
vr_f - smallint
vr_g - smallint
vr_timestamp - timestamp without time zone

tblvrinfo - bigint
vr_id(primary key)
vr_fname - character varying
vr_ltoken - character varying
vr_timestamp - timestamp without time zone

Public dBase As New ADODB.Connection
My connection string is dBase.Open "Driver={PostgreSQL Unicode};Server=DELLSERVER;Database=vrdb;Uid=postgres;"

VB variables are:
varCity(contains the vr_city that will be getting updated)
varID(contains the new id that will be updated to that vr_city and also to the 2nd table.

In tblvrdata:
Update vr_id with varID for that vr_city row
Update vr_timestamp with the current Time/Date.

I need to add varid to the vr_id column for that vr_city row.  Also set vr_timestamp with the current time.

Also need to update tblvrinfo with:
Update vr_id with varID
Update vr_fname with vr_fname from tblvrdata
Update vr_ltoken with vr_ltoken from tblvrdata
Update vr_timestamp with the current Time/Date.

I need the query string/strings to update both tables with that info.
Avatar of earth man2
earth man2
Flag of United Kingdom of Great Britain and Northern Ireland image

You seem to need a good book on SQL.  Try putting data into the database tables using the psql command line interface, then you will get an idea on how to contruct SQL statements.
eg
psql DBNAME
insert into tblvrdata( vr_id ) values ( varID );
update tblvrdata set COLUMN_NAME = value where vr_id = :varID;
select * from tblvrdata where vr_id = :varID;
ASKER CERTIFIED SOLUTION
Avatar of earth man2
earth man2
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of dwelx
dwelx

ASKER

Ok thanks for clarifying.  I had misconceptions about what I was paying for.  Good point I might as well pay a couple bucks on rent a coder as it would be cheaper.  Sorry if I sounded out of line but I really did think someone was being paid to help since I paid a monthly fee.
Avatar of dwelx

ASKER

Understanding what I should expect this is an appropiate answer.  Thank you for your time.