Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Updating Data

Author  Topic 

Tamer
Starting Member

22 Posts

Posted - 2008-08-21 : 02:43:08
Dear Experts,,

I work on Visual FoxPro 9.0 SP2 as a programming language and
the SQl2005 as a database,I publish my SQL data on a V.F. form
and insert,delete,update it by SQL statments written in the V.F
environment.

the problem I face is confirming the update in the database,
In other words,I update the data on the interface of the V.F.
by SQL statments,but no changes happen in the database.

what do you suggest to get the changes in the original tables
in the SQL.

Thanks In Advance

Tamer

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-21 : 03:37:33
how are you performing update? can you post query used?
Go to Top of Page

Tamer
Starting Member

22 Posts

Posted - 2008-08-21 : 03:52:20
UPDATE crsemployee SET e_name1='rafat khamaiseh' WHERE E_NO=1

This statment is put in a command button on the form.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-21 : 03:54:52
quote:
Originally posted by Tamer

UPDATE crsemployee SET e_name1='rafat khamaiseh' WHERE E_NO=1

This statment is put in a command button on the form.


why are hardcoding the E_NO value?
the above code will always update record with E_NO =1 if any exists. Is this what you really intend?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-21 : 03:56:45
quote:
Originally posted by Tamer

UPDATE crsemployee SET e_name1='rafat khamaiseh' WHERE E_NO=1

This statment is put in a command button on the form.


After updation run this query in Query Analyser and see if data are updated

SELECT * FROM crsemployee WHERE E_NO=1


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Tamer
Starting Member

22 Posts

Posted - 2008-08-21 : 04:15:55
I would change the name of the e_no=1 just as a simple test to get
the method of changing the name in the SQL table permenantly then I
will perform more complicated operations.

the problem is when I run this updata statment above by the command
in the V.F. I excute this statment in the sql 2005 environment
to get no change , it keeps the old name.

select * from crsemployee where e_no=1
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-21 : 04:18:44
quote:
Originally posted by Tamer

I would change the name of the e_no=1 just as a simple test to get
the method of changing the name in the SQL table permenantly then I
will perform more complicated operations.

the problem is when I run this updata statment above by the command
in the V.F. I excute this statment in the sql 2005 environment
to get no change , it keeps the old name.

select * from crsemployee where e_no=1



Run update query in query analyser and see if get updated

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-21 : 04:23:26
quote:
Originally posted by Tamer

I would change the name of the e_no=1 just as a simple test to get
the method of changing the name in the SQL table permenantly then I
will perform more complicated operations.

the problem is when I run this updata statment above by the command
in the V.F. I excute this statment in the sql 2005 environment
to get no change , it keeps the old name.

select * from crsemployee where e_no=1



check if crsemployee has some trigger existing if your query didnt update correctly while running in query anlyser.
Go to Top of Page

Tamer
Starting Member

22 Posts

Posted - 2008-08-21 : 04:34:49
Sorry , but how can i get the query analyser in the sql server 2005 environment.

by the way , there are no triggers in the database
Go to Top of Page

Tamer
Starting Member

22 Posts

Posted - 2008-08-21 : 04:45:47
I dont want to disturbe you more , if there is no solution , never mind because the problem
could be in the connection between V.F. and SQL 2005 .

The problem make confusion , so I prefer to think in the connection and the cursor adapter
and the class created in the V.F.

But I dont know what is requested to do in the SQL 2005 side to make the update success
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-21 : 05:10:52
quote:
Originally posted by Tamer

I dont want to disturbe you more , if there is no solution , never mind because the problem
could be in the connection between V.F. and SQL 2005 .

The problem make confusion , so I prefer to think in the connection and the cursor adapter
and the class created in the V.F.

But I dont know what is requested to do in the SQL 2005 side to make the update success


Goto management studio; in the tool bar click new query to get query analyser

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Tamer
Starting Member

22 Posts

Posted - 2008-08-21 : 05:21:06
Okay , that already done but no change in the data
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-08-21 : 05:23:55
quote:
Originally posted by Tamer

Okay , that already done but no change in the data


does update query give some error?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-08-21 : 05:24:57
quote:
Originally posted by Tamer

Okay , that already done but no change in the data


select * from crsemployee where e_no=1
UPDATE crsemployee SET e_name1='rafat khamaiseh' WHERE E_NO=1
select * from crsemployee where e_no=1


Also post table structure


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Tamer
Starting Member

22 Posts

Posted - 2008-08-21 : 08:26:50
If I excute the update and select statments in the SQL2005
environment I get the result as I need , but the problem is when I write and excute the update statment in the visual F.V. ,thus it doesnt reflect on the SQL 2005 database.

So the problem could be mainly with the connection.

to be able to solve this you should hold enough knowlege in the
V.F. connections with other data sources and the cursor adapter
in additionl to the classes.

therefore we should think about the problem accordingly.

Thank you so much for your cooperation

Tamer
Go to Top of Page
   

- Advertisement -