asp_databases thread: ODBC error Name not permitied in context
Message #1 by "Tim Morford" <tmorford@n...> on Mon, 29 Oct 2001 10:16:09 -0500
|
|
Hello all, I am having a time trying to input this string of char in to a BD
Field. What I am doing is putting Table.Field in to a varchar Field, but I
keep getting this error message.
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]The name 'Thisisatest' is not
permitted in this context. Only constants, expressions, or variables allowed
here. Column names are not permitted.
I have tried to change the Field type to char and text but that does not
work either. I did a Response.write(sql) that looked Good, Not sure why this
is happening. I looked around the net found nothing that would give me any
clue on this error. Thanks in advance
Tim Morford
Message #2 by "Tomm Matthis" <matthis@b...> on Mon, 29 Oct 2001 10:20:19 -0500
|
|
Post the relevant line of code for us to look at:
-- Tomm
> -----Original Message-----
> From: Tim Morford [mailto:tmorford@n...]
> Sent: Monday, October 29, 2001 10:16 AM
> To: ASP Databases
> Subject: [asp_databases] ODBC error Name not permitied in context
>
>
> Hello all, I am having a time trying to input this string of char in to a BD
> Field. What I am doing is putting Table.Field in to a varchar Field, but I
> keep getting this error message.
>
> Error Type:
> Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
> [Microsoft][ODBC SQL Server Driver][SQL Server]The name 'Thisisatest' is not
> permitted in this context. Only constants, expressions, or variables allowed
> here. Column names are not permitted.
>
> I have tried to change the Field type to char and text but that does not
> work either. I did a Response.write(sql) that looked Good, Not sure why this
> is happening. I looked around the net found nothing that would give me any
> clue on this error. Thanks in advance
>
> Tim Morford
Message #3 by "Tim Morford" <tmorford@n...> on Mon, 29 Oct 2001 11:02:22 -0500
|
|
loc = Request.Form("Category") & "." &
replace(Request.Form("Question_Text"), " ", "")
sql3 = "INSERT INTO Question " _
& " (Question_Text," _
& "Question_Type," _
& "Required," _
& "Save_Loc," _
& "Min_Len," _
& "Max_Len," _
& "Created_Date," _
& "Created_By," _
& "Question_Sub," _
& "Question_Category" _
& " ) VALUES ( " _
& "'" & trim(Question_Text) & "'," _
& "'" & Request.Form("Item_Type") & "'," _
& "'0'," _
& "" & trim(loc) & "," _
& "'" & Request.Form("MinChars") & "'," _
& "'" & Request.Form("MaxChars") & "'," _
& "" & Date() & "," _
& "'" & login & "'," _
& "'0'," _
& "" & Request.Form("Category") & ");"
Response.write
INSERT INTO
Question(Question_Text,Question_Type,Required,Save_Loc,Min_Len,Max_Len,Creat
ed_Date,Created_By,Question_Sub,Question_Category ) VALUES (
'699','1','0',Test.Thisisanothertestquestion,'1','30',10/29/2001,'0','0',Tes
t);
Tim Morford
-----Original Message-----
From: Tomm Matthis [mailto:matthis@b...]
Sent: Monday, October 29, 2001 10:20 AM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
Post the relevant line of code for us to look at:
-- Tomm
Message #4 by "Tim Morford" <tmorford@n...> on Mon, 29 Oct 2001 11:17:19 -0500
|
|
Also I did an update by hand in the DB and it worked just fine.
Tim Morford
-----Original Message-----
From: Tomm Matthis [mailto:matthis@b...]
Sent: Monday, October 29, 2001 10:20 AM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
Post the relevant line of code for us to look at:
-- Tomm
Message #5 by "Tomm Matthis" <matthis@b...> on Mon, 29 Oct 2001 11:19:27 -0500
|
|
It appears that you need to check the field type for the data you're
inserting.
Some of the them should not need quote marks, if they're integers, but others
should need them.
-- Tomm
> -----Original Message-----
> From: Tim Morford [mailto:tmorford@n...]
> Sent: Monday, October 29, 2001 11:02 AM
> To: ASP Databases
> Subject: [asp_databases] RE: ODBC error Name not permitied in context
>
>
> loc = Request.Form("Category") & "." &
> replace(Request.Form("Question_Text"), " ", "")
>
>
> sql3 = "INSERT INTO Question " _
> & " (Question_Text," _
> & "Question_Type," _
> & "Required," _
> & "Save_Loc," _
> & "Min_Len," _
> & "Max_Len," _
> & "Created_Date," _
> & "Created_By," _
> & "Question_Sub," _
> & "Question_Category" _
> & " ) VALUES ( " _
> & "'" & trim(Question_Text) & "'," _
> & "'" & Request.Form("Item_Type") & "'," _
> & "'0'," _
> & "" & trim(loc) & "," _
> & "'" & Request.Form("MinChars") & "'," _
> & "'" & Request.Form("MaxChars") & "'," _
> & "" & Date() & "," _
> & "'" & login & "'," _
> & "'0'," _
> & "" & Request.Form("Category") & ");"
>
>
> Response.write
>
> INSERT INTO
> Question(Question_Text,Question_Type,Required,Save_Loc,Min_Len,Max_Len,Creat
> ed_Date,Created_By,Question_Sub,Question_Category ) VALUES (
> '699','1','0',Test.Thisisanothertestquestion,'1','30',10/29/2001,'0','0',Tes
> t);
>
>
> Tim Morford
> -----Original Message-----
> From: Tomm Matthis [mailto:matthis@b...]
> Sent: Monday, October 29, 2001 10:20 AM
> To: ASP Databases
> Subject: [asp_databases] RE: ODBC error Name not permitied in context
>
>
> Post the relevant line of code for us to look at:
>
> -- Tomm
Message #6 by "Michiel van Otegem \(lists ONLY\)" <michiel_lists@a...> on Mon, 29 Oct 2001 17:25:21 +0100
|
|
Try putting apostrophes around the values...
---
Michiel van Otegem
ASPNL.com - ASP/ASP.NET/XML Teacher
ASPFriends.com - Moderator
http://www.aspnl.com
http://www.aspalliance.com/michiel
off-list email: michiel@a...
---
----- Original Message -----
From: "Tim Morford" <tmorford@n...>
To: "ASP Databases" <asp_databases@p...>
Sent: Monday, October 29, 2001 5:02 PM
Subject: [asp_databases] RE: ODBC error Name not permitied in context
> loc = Request.Form("Category") & "." &
> replace(Request.Form("Question_Text"), " ", "")
>
>
> sql3 = "INSERT INTO Question " _
> & " (Question_Text," _
> & "Question_Type," _
> & "Required," _
> & "Save_Loc," _
> & "Min_Len," _
> & "Max_Len," _
> & "Created_Date," _
> & "Created_By," _
> & "Question_Sub," _
> & "Question_Category" _
> & " ) VALUES ( " _
> & "'" & trim(Question_Text) & "'," _
> & "'" & Request.Form("Item_Type") & "'," _
> & "'0'," _
> & "" & trim(loc) & "," _
> & "'" & Request.Form("MinChars") & "'," _
> & "'" & Request.Form("MaxChars") & "'," _
> & "" & Date() & "," _
> & "'" & login & "'," _
> & "'0'," _
> & "" & Request.Form("Category") & ");"
>
>
> Response.write
>
> INSERT INTO
>
Question(Question_Text,Question_Type,Required,Save_Loc,Min_Len,Max_Len,Creat
> ed_Date,Created_By,Question_Sub,Question_Category ) VALUES (
>
'699','1','0',Test.Thisisanothertestquestion,'1','30',10/29/2001,'0','0',Tes
> t);
>
>
> Tim Morford
> -----Original Message-----
> From: Tomm Matthis [mailto:matthis@b...]
> Sent: Monday, October 29, 2001 10:20 AM
> To: ASP Databases
> Subject: [asp_databases] RE: ODBC error Name not permitied in context
>
>
> Post the relevant line of code for us to look at:
>
> -- Tomm
Message #7 by "Tim Morford" <tmorford@n...> on Mon, 29 Oct 2001 12:40:35 -0500
|
|
Have done both, Before I sent the request in. It still will not work
Tim Morford
-----Original Message-----
From: Michiel van Otegem (lists ONLY) [mailto:michiel_lists@a...]
Sent: Monday, October 29, 2001 11:25 AM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
Try putting apostrophes around the values...
---
Michiel van Otegem
ASPNL.com - ASP/ASP.NET/XML Teacher
ASPFriends.com - Moderator
http://www.aspnl.com
http://www.aspalliance.com/michiel
off-list email: michiel@a...
---
----- Original Message -----
From: "Tim Morford" <tmorford@n...>
To: "ASP Databases" <asp_databases@p...>
Sent: Monday, October 29, 2001 5:02 PM
Subject: [asp_databases] RE: ODBC error Name not permitied in context
> loc = Request.Form("Category") & "." &
> replace(Request.Form("Question_Text"), " ", "")
>
>
> sql3 = "INSERT INTO Question " _
> & " (Question_Text," _
> & "Question_Type," _
> & "Required," _
> & "Save_Loc," _
> & "Min_Len," _
> & "Max_Len," _
> & "Created_Date," _
> & "Created_By," _
> & "Question_Sub," _
> & "Question_Category" _
> & " ) VALUES ( " _
> & "'" & trim(Question_Text) & "'," _
> & "'" & Request.Form("Item_Type") & "'," _
> & "'0'," _
> & "" & trim(loc) & "," _
> & "'" & Request.Form("MinChars") & "'," _
> & "'" & Request.Form("MaxChars") & "'," _
> & "" & Date() & "," _
> & "'" & login & "'," _
> & "'0'," _
> & "" & Request.Form("Category") & ");"
>
>
> Response.write
>
> INSERT INTO
>
Question(Question_Text,Question_Type,Required,Save_Loc,Min_Len,Max_Len,Creat
> ed_Date,Created_By,Question_Sub,Question_Category ) VALUES (
>
'699','1','0',Test.Thisisanothertestquestion,'1','30',10/29/2001,'0','0',Tes
> t);
>
>
> Tim Morford
> -----Original Message-----
> From: Tomm Matthis [mailto:matthis@b...]
> Sent: Monday, October 29, 2001 10:20 AM
> To: ASP Databases
> Subject: [asp_databases] RE: ODBC error Name not permitied in context
>
>
> Post the relevant line of code for us to look at:
>
> -- Tomm
Message #8 by "Tim Morford" <tmorford@n...> on Mon, 29 Oct 2001 13:23:18 -0500
|
|
I just used ADODB.Recordset and it worked, I guess I will use that. Thanks
anyway.
Tim Morford
-----Original Message-----
From: Tim Morford [mailto:tmorford@n...]
Sent: Monday, October 29, 2001 12:41 PM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
Have done both, Before I sent the request in. It still will not work
Tim Morford
-----Original Message-----
From: Michiel van Otegem (lists ONLY) [mailto:michiel_lists@a...]
Sent: Monday, October 29, 2001 11:25 AM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
Try putting apostrophes around the values...
---
Michiel van Otegem
ASPNL.com - ASP/ASP.NET/XML Teacher
ASPFriends.com - Moderator
http://www.aspnl.com
http://www.aspalliance.com/michiel
off-list email: michiel@a...
---
----- Original Message -----
From: "Tim Morford" <tmorford@n...>
To: "ASP Databases" <asp_databases@p...>
Sent: Monday, October 29, 2001 5:02 PM
Subject: [asp_databases] RE: ODBC error Name not permitied in context
> loc = Request.Form("Category") & "." &
> replace(Request.Form("Question_Text"), " ", "")
>
>
> sql3 = "INSERT INTO Question " _
> & " (Question_Text," _
> & "Question_Type," _
> & "Required," _
> & "Save_Loc," _
> & "Min_Len," _
> & "Max_Len," _
> & "Created_Date," _
> & "Created_By," _
> & "Question_Sub," _
> & "Question_Category" _
> & " ) VALUES ( " _
> & "'" & trim(Question_Text) & "'," _
> & "'" & Request.Form("Item_Type") & "'," _
> & "'0'," _
> & "" & trim(loc) & "," _
> & "'" & Request.Form("MinChars") & "'," _
> & "'" & Request.Form("MaxChars") & "'," _
> & "" & Date() & "," _
> & "'" & login & "'," _
> & "'0'," _
> & "" & Request.Form("Category") & ");"
>
>
> Response.write
>
> INSERT INTO
>
Question(Question_Text,Question_Type,Required,Save_Loc,Min_Len,Max_Len,Creat
> ed_Date,Created_By,Question_Sub,Question_Category ) VALUES (
>
'699','1','0',Test.Thisisanothertestquestion,'1','30',10/29/2001,'0','0',Tes
> t);
>
>
> Tim Morford
Message #9 by David Cameron <dcameron@i...> on Tue, 30 Oct 2001 09:18:32 +1100
|
|
Unless I am mistaken your problem is with the fields definitions.
This was your existing SQL Statement.
INSERT INTO Question
(Question_Text, Question_Type, Required, Save_Loc, Min_Len,
Max_Len, Created_Date, Created_By, Question_Sub, Question_Category)
VALUES
('699', '1', '0', Test.Thisisanothertestquestion, '1', '30',
10/29/2001, '0' ,'0', Test)
Problems with this are:
1. Some integer fields appear to have quotes around them. Put quotes around
string/text fields. Of course if they are not Int fields then this not an
error.
2. the value Test.Thisisanothertestquestion should have quotes around it.
SQL is taking this an a reference to a database object, eg MyTable.MyColumn.
regards
David Cameron
nOw.b2b
dcameron@i...
-----Original Message-----
From: Tim Morford [mailto:tmorford@n...]
Sent: Tuesday, 30 October 2001 4:23 AM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
I just used ADODB.Recordset and it worked, I guess I will use that. Thanks
anyway.
Tim Morford
-----Original Message-----
From: Tim Morford [mailto:tmorford@n...]
Sent: Monday, October 29, 2001 12:41 PM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
Have done both, Before I sent the request in. It still will not work
Tim Morford
-----Original Message-----
From: Michiel van Otegem (lists ONLY) [mailto:michiel_lists@a...]
Sent: Monday, October 29, 2001 11:25 AM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
Try putting apostrophes around the values...
Message #10 by "Ken Schaefer" <ken@a...> on Tue, 30 Oct 2001 13:36:52 +1100
|
|
Your error message was:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]The name 'Thisisatest' is not
permitted in this context. Only constants, expressions, or variables allowed
here. Column names are not permitted.
But the code you posted:
Response.write
INSERT INTO
Question(Question_Text,Question_Type,Required,Save_Loc,Min_Len,Max_Len,Creat
ed_Date,Created_By,Question_Sub,Question_Category ) VALUES (
'699','1','0',Test.Thisisanothertestquestion,'1','30',10/29/2001,'0','0',Tes
t);
does not contain "Thisisatest" anywhere in it. The error is occuring
somewhere else...
Cheers
Ken
Message #11 by "Tim Morford" <tmorford@n...> on Mon, 29 Oct 2001 17:59:32 -0500
|
|
Nope that was not the Problem, I added quotes, removed quotes, changed the
Field type, add the data in manually, moved the insert of the text to the
last part of the insert, moved the text to the first part of the insert,
still nothing worked, moved to rs.addnew and it worked. So, I am not that
worried about it, I will change it later on to make it a SP.
Tim Morford
-----Original Message-----
From: David Cameron [mailto:dcameron@i...]
Sent: Monday, October 29, 2001 5:19 PM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
Unless I am mistaken your problem is with the fields definitions.
This was your existing SQL Statement.
INSERT INTO Question
(Question_Text, Question_Type, Required, Save_Loc, Min_Len,
Max_Len, Created_Date, Created_By, Question_Sub, Question_Category)
VALUES
('699', '1', '0', Test.Thisisanothertestquestion, '1', '30',
10/29/2001, '0' ,'0', Test)
Problems with this are:
1. Some integer fields appear to have quotes around them. Put quotes around
string/text fields. Of course if they are not Int fields then this not an
error.
2. the value Test.Thisisanothertestquestion should have quotes around it.
SQL is taking this an a reference to a database object, eg MyTable.MyColumn.
regards
David Cameron
nOw.b2b
dcameron@i...
-----Original Message-----
From: Tim Morford [mailto:tmorford@n...]
Sent: Tuesday, 30 October 2001 4:23 AM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
I just used ADODB.Recordset and it worked, I guess I will use that. Thanks
anyway.
Tim Morford
-----Original Message-----
From: Tim Morford [mailto:tmorford@n...]
Sent: Monday, October 29, 2001 12:41 PM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
Have done both, Before I sent the request in. It still will not work
Tim Morford
-----Original Message-----
From: Michiel van Otegem (lists ONLY) [mailto:michiel_lists@a...]
Sent: Monday, October 29, 2001 11:25 AM
To: ASP Databases
Subject: [asp_databases] RE: ODBC error Name not permitied in context
Try putting apostrophes around the values...
$subst('Email.Unsub')
Message #12 by "NabinKumar Sahu" <sahunabin@r...> on 30 Oct 2001 04:47:03 -0000
|
|
Ken
There are 9 column but you are entering 10 data."Test.Thisisanothertestquestion" data is extra ,so error is coming.
Nabin
INDIA
|