ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old July 30th, 2004, 07:44 AM
JackSNVC JackSNVC is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 72 JackSNVC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 6 sec
Reputation Power: 5
writing to sql server

Hi everyone. I am trying to write to sql server with just one text field to test to see if what I have is working. I can pull up the fields so I know it is connecting but when I go to insert it is giving me this error:

MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'dbo.Table1'

below is all the code from the page. anyone have any ideas???
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "form1">
<cfquery datasource="Vacancy">
INSERT INTO dbo.Table1 ("position") VALUES (
<cfif IsDefined("FORM.position") AND #FORM.position# NEQ "">
'#FORM.position#'
<cfelse>
NULL
</cfif>
)
</cfquery>
</cfif>
<cfquery name="Recordset1" datasource="Vacancy">
SELECT * FROM dbo.Table1
</cfquery>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<p>&nbsp;</p>

<table border="1" cellpadding="2" cellspacing="2">
<tr>
<td>position</td>
<td>programmanager</td>
<td>availability</td>
<td>travel</td>
<td>interview</td>
<td>start</td>
<td>type</td>
<td>salary</td>
<td>rate</td>
<td>temp</td>
<td>customer</td>
<td>location</td>
<td>workhours</td>
<td>clearance</td>
<td>duties</td>
<td>experience</td>
<td>new</td>
</tr>
<cfoutput query="Recordset1">
<tr>
<td>#Recordset1.position#</td>
<td>#Recordset1.programmanager#</td>
<td>#Recordset1.availability#</td>
<td>#Recordset1.travel#</td>
<td>#Recordset1.interview#</td>
<td>#Recordset1.start#</td>
<td>#Recordset1.type#</td>
<td>#Recordset1.salary#</td>
<td>#Recordset1.rate#</td>
<td>#Recordset1.temp#</td>
<td>#Recordset1.customer#</td>
<td>#Recordset1.location#</td>
<td>#Recordset1.workhours#</td>
<td>#Recordset1.clearance#</td>
<td>#Recordset1.duties#</td>
<td>#Recordset1.experience#</td>
<td>#Recordset1.new#</td>
</tr>
</cfoutput>
</table>
<p>&nbsp;</p>

<form method="post" name="form1" action="<cfoutput>#CurrentPage#</cfoutput>">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Position:</td>
<td><input type="text" name="position" value="" size="32"></td>
</tr>
<tr valign="baseline">
<td nowrap align="right">&nbsp;</td>
<td><input type="submit" value="Insert Record"></td>
</tr>
</table>
<input type="hidden" name="MM_InsertRecord" value="form1">
</form>
<p>&nbsp;</p>
</body>

</html>

Reply With Quote
  #2  
Old July 30th, 2004, 08:41 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
Omit the dbo. prefix and try it again. Unless the account you are connecting to SQL Server with from CF is the dbo of that database, this will fail.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #3  
Old July 30th, 2004, 08:45 AM
JackSNVC JackSNVC is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 72 JackSNVC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 6 sec
Reputation Power: 5
tried it, didnt work, any ideas?

hey kiteless I appreciate your help. I took out the dbo strings and it didnt help. This is the error I got when I ran the page again. Any ideas?

Error Executing Database Query.
[MERANT][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'Table1'.

The Error Occurred in C:\Inetpub\wwwroot\Vacancy\TMP13gk21o3hb.cfm: line 11

9 : </cfif>
10 : )
11 : </cfquery>
12 : </cfif>
13 : <cfquery name="Recordset1" datasource="Vacancy">



is ther epossibly a better way to write the insert code, or a specific way that sql likes better than others?

Reply With Quote
  #4  
Old July 30th, 2004, 09:54 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,627 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 10 h 8 m 55 sec
Reputation Power: 53
From the error, it appears that the user account that CF is using to access the SQL server can't "see" Table1. Are you sure there is a table called Table1 in the database? Have you given the account that CF is using permission to access that table? Have you set the default database for the account that CF is using to the desired database?

If CF has permission, you should be able to access the table by prefixing it with the database name, like "mydb.table1" assuming "mydb" is the name of the database where "table1" exists. But if you set the default database correctly you should not have to do this.

Reply With Quote
  #5  
Old July 30th, 2004, 10:16 AM
JackSNVC JackSNVC is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 72 JackSNVC User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 6 sec
Reputation Power: 5
wow damn SQL

Kiteless - I appreciate your help. Yea man I am doing this for testing so I didnt name the db. anything butttt I fixed the problem. I had to go through the DB and make sure everything was set up perfectly or it wont do anything for me. The pkey wasn't enabled and upon import of the form to the web page it added some extra "" characters to some fields which messed it up also. but now I have it writing. Now onto some new tricks. I just picked up a copy of cold fusion two days ago so I am learning. I appreciate your help. i will be back for more questions probably some time soon. thanks.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > writing to sql server


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway