Forums

This topic is locked

Lookup fields

Posted 19 Apr 2004 15:52:21
1
has voted
19 Apr 2004 15:52:21 Reg Coles posted:
trying to update a lookup field in SQL via stored procedures but it keeps on coming up with errors.
[Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near 'Type'.

Stored Procedure:
INSERT INTO dbo.l_Lender Type (description)
VALUES ('Lender')

Variables Run-time Value
lender Request("Lender"

The field that needs updating is a text field. I can only see the field via "Views". The person needs to enter data which is then stored in database, I have a few lookups that need to be updated.
Can lookup fields be updated?

Thanks

Replies

Replied 20 Apr 2004 02:35:02
20 Apr 2004 02:35:02 Phil Shevlin replied:
Whats Type (description) ?

I'm also not sure what you mean by lookup.
Replied 20 Apr 2004 13:22:21
20 Apr 2004 13:22:21 Reg Coles replied:
My head wasn't feeling good yesterday,let me try again. Scrap the first message.
Trying to add data to a field but the following error comes up.
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the varchar value 'Mr' to a column of data type int.
Using a textbox to enter data and insert record with text as submit but get above mentioned error.


Replied 20 Apr 2004 13:47:26
20 Apr 2004 13:47:26 Dave Thomas replied:
Syntax error converting the varchar value 'Mr' to a column of data type int.

well basically theats saying your trying to inset "Mr" into a column which takes numbers only "int",

change the field type.

Regards,
Dave

[DWMX 2004]|[FlashMX 2004 Pro]|[Studio MX 2004]|[SQL]|[Access2000/2002]|[ASP/VBScript]|[XP-Pro]
If you like online gaming, please register @ www.nova-multigaming.com
Replied 20 Apr 2004 15:03:20
20 Apr 2004 15:03:20 Phil Shevlin replied:
Those errors (this one and the one above) suggest that the syntax of your sql statement is getting all messed up. What are you trying to do, show us your real code.
Replied 21 Apr 2004 18:17:38
21 Apr 2004 18:17:38 Reg Coles replied:
Took yesterday to look at the database properly as I needed to see where I was and what I was doing wrong. I was looking at the database from the wrong way, learning the hard way.
The database is a CRM which has been modified to suit the company business,so some of the fields are called different to standard ms-sql database.
What I'm trying to do is the following.
A client enters data via the web which connects to the database to update or insert new records.
Looked at the four records causing the problem.
2 records need to be an 'int' in the database, so need to convert it from "text" to 'int'.
And basically the other 2 have the same problem expect need to be changed to 'uniqueidentifiers' from text.
The records also look at another table with the one-many relationship.
I think I need to create two stored procedures - one to convert varchar to int and another to convert varchar to uniqueidentifier.
The problem is I not to clued up on writing sql statements so alittle help in writing a convert or cast statment would be helpful.
I hope this expalins things better, SQL is not my best subject but learning.
Replied 21 Apr 2004 19:47:09
21 Apr 2004 19:47:09 Phil Shevlin replied:
You're kinda blowing me away with what you're saying. I really think you're over-thinking things.

You are simply inserting (and/or updating) data into a table or two. It sounds like you're not using stored procedures -- yet. I really don't think you need to change ANY of the datatypes yet.

Why not just build a simple page that inserts a new record into one of your tables. Then build one that is able to update that same record. Use DMX's built-in server bahaviors to accomplish this. Don't modify anything.

Replied 21 Apr 2004 19:47:38
21 Apr 2004 19:47:38 Dave Thomas replied:
your going to create problems for yourself doing what you described.

im by no means an expert, i myself am still an avid learner so i may be wrong but i prefer to make the databse correct rather than making workarounds and functions to convert.

i'd rewrite the db if i was you, your problems will go away if you do that.

Regards,
Dave

[DWMX 2004]|[FlashMX 2004 Pro]|[Studio MX 2004]|[SQL]|[Access2000/2002]|[ASP/VBScript]|[XP-Pro]
If you like online gaming, please register @ www.nova-multigaming.com

Edited by - UltraDav on 22 Apr 2004 00:28:00
Replied 21 Apr 2004 19:57:54
21 Apr 2004 19:57:54 Phil Shevlin replied:
Beat you Dave - by 29 seconds <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>
Replied 23 Apr 2004 17:19:34
23 Apr 2004 17:19:34 Reg Coles replied:
Going to rewrite some of the database, I'll let you know of the outcome. Thanks for all comments.

Reply to this topic