Question

ODBC Count Field Incorrect

Asked by: hustedj

I moved my webserver from one server to another. My operating system on my old server was Windows NT. My new server has windows 2000 server. I have visual interdev 6.0. My problem is when I try to run an application, I get an error.

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error
/contactinfoapp/_ScriptLibrary/Recordset.ASP, line 636

I have installed the Front Page extension, I have updated to the latest MDAC.

I'm using a statement select * from table where field = ? and I am using a recordset to pass a paramenter into the question mark. If I hard code it select * from table where field = 'yellow' then the application works just fine. I have a feeling it has something to do with my data connection, but I just can't seem to figure it out.

Thanks in advance.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-05-17 at 15:06:20ID21854558
Tags

field

,

incorrect

,

count

Topic

Microsoft Visual Interdev

Participating Experts
3
Points
500
Comments
14

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. ODBC problem...
    I am using Visual Interdev to create an .asp file. Following is the similar code that i am using. **** <%@ Language=VBScript %> <HTML> <HEAD> <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> </HEAD> <BODY> ...
  2. ODBC
    I'm trying to reload Citrix metaframe 1.0 on my w2000 server and i keep getting an error that says I have to reload my ODBC drivers. I've reloaded MDAC but no luck. When i try and get into the ODBC setup it tells me that my resource DLL is different than my administrator DLL...
  3. How do you uninstall MDAC (ODBC)?
    I loaded the incorrect version of ODBC drives when attempting to re-install lost application. I installed version 2.573.9001.00 of "Microsoft for Oracle". I later discovered that I need to install version 2.573.6526.00. When I attempt to re-install the older version...
  4. odbc
    Dear Friends, 1) Is there any way to Connect, MS-Access TABLE to Oracle, using SQL*loader etc.... 2)I've made a program(Data entry Screen) in Visualbasic 6. Using MS-Access, Backend. 1. How to use ODBC for VB & oracle? PLEASE REPLY. YOURS, AMEER.

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: fruhjPosted on 2006-05-17 at 15:09:40ID: 16704237

Are you using an access database?
Can you paste some additional code - I'd like to see the connection string and the other code around line 636

 

by: hustedjPosted on 2006-05-17 at 17:11:57ID: 16705032

I am using SQL 2000

The _ScriptLibrary/Recordset.asp is part of the built in stuff that just automatically gets inserted when you create a new product.

Here is some of the code from the recordset that it is having a problem with...

<SCRIPT LANGUAGE="JavaScript" RUNAT="server">
function _setParametersRecordset1()
{
      Recordset1.setParameter(0,Session("SalesRep"));
}
function _initRecordset1()
{
      Recordset1.advise(RS_ONBEFOREOPEN, _setParametersRecordset1);
      var DBConn = Server.CreateObject('ADODB.Connection');
      DBConn.ConnectionTimeout = Application('Database_ConnectionTimeout');
      DBConn.CommandTimeout = Application('Database_CommandTimeout');
      DBConn.CursorLocation = Application('Database_CursorLocation');
      DBConn.Open(Application('Database_ConnectionString'), Application('Lumbermens_RuntimeUserName'), Application('Database_RuntimePassword'));
      var cmdTmp = Server.CreateObject('ADODB.Command');
      var rsTmp = Server.CreateObject('ADODB.Recordset');
      cmdTmp.ActiveConnection = DBConn;
      rsTmp.Source = cmdTmp;
      cmdTmp.CommandType = 1;
      cmdTmp.CommandTimeout = 10;
      cmdTmp.CommandText = 'select * from table where field = ?';
      rsTmp.CacheSize = 10;
      rsTmp.CursorType = 3;
      rsTmp.CursorLocation = 3;
      rsTmp.LockType = 3;
      Recordset1.setRecordSource(rsTmp);
      Recordset1.open();
      if (thisPage.getState('pb_Recordset1') != null)
            Recordset1.setBookmark(thisPage.getState('pb_Recordset1'));
}
function _Recordset1_ctor()
{
      CreateRecordset('Recordset1', _initRecordset1, null);
}
function _Recordset1_dtor()
{
      Recordset1._preserveState();
      thisPage.setState('pb_Recordset1', Recordset1.getBookmark());
}
</SCRIPT>

Thanks.

 

by: trainsdsePosted on 2006-05-18 at 23:43:46ID: 16715555

Parameters using the ? mark can cause this error when converting from access to mssql.  Post the code where you create the query and pass the parameter and I can show you how to change it to make it work.

Thomas

 

by: hustedjPosted on 2006-05-19 at 04:57:11ID: 16717135

I'm not converting from access to mssql. I've always used sql for my database. I'm switching from windows NT to windows 2000 server. Above is the recordset where I pass in the parameter.

 

by: trainsdsePosted on 2006-05-19 at 05:09:55ID: 16717205

Okay, sorry about that, good luck.

 

by: bigbillydotcomPosted on 2006-05-22 at 09:15:05ID: 16735485

how about doing a response.write at the top of the page to check your session variable that you are passing as a parameter?
put this as the second line after setting the code language
<%
response.write "Salesrep="+cstr(Session("SalesRep"))
%>

and see what the value of that session variable is

 

by: bigbillydotcomPosted on 2006-05-22 at 09:17:30ID: 16735513

also - try hardocding the session variable to make sure it is going to work

Session("SalesRep")="bigbilly"

 

by: bigbillydotcomPosted on 2006-05-22 at 09:18:51ID: 16735521

it has to be something with your parameters going into the recordset
no other reason the recordset object should return that error unless its not dealing wit hthe passed paramter properly

 

by: hustedjPosted on 2006-05-22 at 09:36:59ID: 16735723

I hard coded in the parameter and it works just fine. It is only when I have the question mark (select * from table where field = ?)

I transfered an intranet based application from windows NT to windows 2000 using the same code and that works just fine. Do you think it has anything to do with the firewall?

 

by: bigbillydotcomPosted on 2006-05-22 at 11:11:14ID: 16736522

no - i dont beleive it is a firewall issue at all

It has to do with the setting of the parameter - since it works when hard coded
the code you are posting - it looks like the output of a DTC recordset control
is that correct?

 

by: bigbillydotcomPosted on 2006-05-22 at 11:32:48ID: 16736710

something looks fishy about your recordset objecti cant seem to figure out how you set it up to work like that
can you tell me more about what you are trying to accomplish?
I have used VI for a long time, and have found alot easier methods than using the DTC recordset controls
i'd be glad to share if you tell me what you are trying to do
cheers

 

by: hustedjPosted on 2006-05-22 at 14:02:04ID: 16737857

I did figure my problem out, but if there is an easier method that I should be using, I'm all about learning!

First let me explain how I fixed my problem.

I was coping all files to my new server, including the files that normally get created by creating a new project. I decided to delete those and only copied my .asp/.htm pages. I created a new project (on the new server with the same name as it was on the old server), set up my dataconnection, then I copied my .asp/.htm pages. That was set one of fixing my problem.

Set two. I forgot about that I was using the global.asp to pass in some parameters/login information. I added that code, which gave me another error.

I then checked my ODBC connection and realized I was still pointing at our old database. Once I established an odbc connection to the correct database, it started working.

It is always the little things that should be so easy that always get you!

Thank you to all your suggestions!

Back to what BIGBILLYDOTCOM was talking about.

What I'm trying to do is when a sales rep enters their username (salesrep number), they get their customer information. That mainmenu page when they login takes their salesrep number and puts it as a session variable.

Another thing it does is there are other people that have access to login that are not salesreps that need access particular pages. The mainmenu determines if they are a sales rep, if they are a sales rep it displays buttons that a non-salesrep would not see. If they aren't a sales rep then they get other buttons and other access to different pages.

Other pages do other things. I always use the recordset DTC control and use the recordset.updaterecord, etc. But if there is a better way, by all means, share!

 

by: bigbillydotcomPosted on 2006-05-22 at 14:26:16ID: 16738030

i thought something was missing - i just couldnt figure out how that ODBC error could come out of the code you posted

I am not going to say the way I do things are "better" - esp. if you are already productive
but there are some alternative methods to using the DTC's in VI - that is, create your own methods/subs/functions to create those design elements

One of the great "Eurekas" I had was that basically all asp was doing was "writing" html back to the browser, and the DTC's accomplished this by means of using some java libraries and exposing those libraries subs/functions/properties/methods via the VI user interface

I spent FOREVER trying various hacks on the DTC's (for instance, displaying clickable images in the the Grid Control) to accomplish what I wanted to do
before I gave up and learned how to create my own functions/subs that would spit out the html code I wanted

most of the code would therefore be considered "classic asp"

Anyway - to make a long story short here, is an example of making a simple grid from a sql stored procedure

<%
Function Prt(stuff)
     response.write cstr(stuff)+vbcrlf
End Function

set con=server.CreateObject("adodb.connection")
con.Open(application("ConnectionString")),,,adcmdStoredProc
mysql = "Exec ProcAuto_sp5 @ID='"+ID+"'"
set rs = con.Execute(mysql)

     Prt("<table><tr><td>Name</td><td>Address></td><td>Phone</td></tr>")

if Not rs.EOF then
     Do until rs.EOF
          Prt("<tr><td>")
          Prt(rs("Name"))
          Prt("</td><td>")
          Prt(rs("Address"))
          Prt("</td><td>")
          Prt(rs("Phone"))
          Prt("</td></tr>")
   rs.movenext
     loop
end if

     Prt("</table>")
rs.close
set rs = nothing
con.close
set con = nothing
%>

 

by: hustedjPosted on 2006-05-22 at 17:55:27ID: 16739046

Thanks everyone for all your help. Bigbilldotcom, I'll have to try out what you are talking about.

Thanks again.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...