Question

Connection String to Access Database

Asked by: itkamisama

I am trying to create a connection to an Access Database in my GoDaddy account. I used DNSless connection strings several years ago but I don't remember how I did it.
GoDaddy allows me to set up DNS but I am not able to make a connection. I also use Dramweaver for coding.
I would like to have the connections string in a seperate file and use an include statement.
I am under a deadline unfortunately.

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
2009-11-03 at 20:23:43ID24869766
Tags

ASP MS Access

Topics

Databases Miscellaneous

,

Active Server Pages (ASP)

Participating Experts
3
Points
500
Comments
32

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. Setup GoDaddy and DNS
    I registered a Domain name with GoDaddy and would like to use their DNS servers as Secondary preferably for the domain name. Can this be achieved or do I need to go elsewhere for a Secondary DNS server? Exactly how would I set up GoDaddy if this is possible? I'm runing W3K a...
  2. domain godaddy
    I have a website in a windows hosting on godaddy "www.igurr.com" and i want to create another website inside the same hosting so i created a new folder for this site "actocity" and redirected the domain "www.actocity.com" to this new folder, my p...

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: carrzkissPosted on 2009-11-03 at 20:45:28ID: 25736465

Either of these will work for GoDaddy.
Tested and proven to work.

Carrzkiss

<% ' Access 2007
Set objConn = CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & _
Server.MapPath ("YourDB.accdb") & ";"
objConn.Open
%>

<% ' Pre-Access 2007
Set objConn = CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("YourDB.mdb") & ";"
objConn.Open
%>

 

by: carrzkissPosted on 2009-11-03 at 20:47:41ID: 25736471

Here is a code that you can test to make sure that everything works
Properly with GoDaddy and the connection string.

http://ee.cffcs.com/Q_24862097/Q_24862097.asp?id=1
code
http://ee.cffcs.com/Q_24862097/Q_24862097.zip

Make sure that when you test it out on your site, that you include the
QueryString    ?id=1
If not, then it will error out.   =>   Q_24862097.asp?id=1

Carrzkiss

 

by: sybePosted on 2009-11-03 at 23:07:51ID: 25737065

 

by: itkamisamaPosted on 2009-11-04 at 08:45:14ID: 25741210

First of all thank you for the quick response.

Carrzkiss, I uploaded the test file to my account and received an internal 500 error. Do I have to have the database and the file in the same directory to make it work?

 

by: carrzkissPosted on 2009-11-04 at 11:53:43ID: 25743199

We need to know about the error.

In Internet Explorer
Go to [Tools]
[Internet Options]
Click on the [Advanced Tab]
Scroll down until you find
[Show Friendly HTTP Errors Messages] (Uncheck this option)

Now, Close out of IE and reopen it, and you will be able to see you
True LIVE errors.
==========================================
Once you can get the errors to show, please post it here.


The database can be in any sub-folder within the main site.
The data connection page (the include file with the connection)
Need to be in the root of the site directory.

Example

root/mycon.asp
root/data/mydb.mdb

Then, in your pages, you simply add the include:
<!--#include file="mycon.asp"-->

-------
Sometimes that is an issue with how deep you go, if your pages url is
page/page.asp
And the folder structure is:
root/page/page.asp
Then you will have to create a new connection to the Database.

The only way to get around this, is to connection to the database using the physical path.

In that case.
You will do something like this

set objConn=Server.CreateObject("ADODB.Connection")
objConn.Provider="Microsoft.Jet.OLEDB.4.0 "
objConn.Open "G:/Inetpub/wwwroot/Data/Mydata.mdb"

You will need to get the physical path of your database from GoDaddy.
And then use it, and you can create your mycon.asp
And link to it without ever having any issue.

So, you have 2 ways of doing it.

Good Luck
Carrzkiss

 

by: itkamisamaPosted on 2009-11-08 at 11:36:32ID: 25771554

I was finally able to get dns to work and was able to connect the database that way

 

by: carrzkissPosted on 2009-11-08 at 15:59:39ID: 25772640

Out of all the information that I have given to you on this thread
With proven code that works on all servers, even GoDaddy.
And you are just going to close this post out, with accepting your
DNS post as Answer?

That is totally uncool.
I know that you are some-what new to the site : 08/13/09
You should know that be now, the people that try to help you in this threads
Take time out of their days to help on this site.
We do not get paid to help people like yourself, we are doing this out of the kindness
Of our own hearts and for a few points here and there.
And then we have issues like this one where you take for granted the information that
Has been provided to you.

This is very sad!

Carrzkiss

 

by: hexemesPosted on 2009-11-08 at 16:30:48ID: 25772733

well put 'Carrzkiss'

 

by: carrzkissPosted on 2009-11-08 at 16:48:56ID: 25772784

thanks.
I was so annoyed that I made some mistakes in what I wrote
Should have proofread before I posted.... :=)

Have a good one.
Carrzkiss

 

by: itkamisamaPosted on 2009-11-08 at 20:31:55ID: 25773394

I am sorry I made you angry but the solutions you posted did not work. I spent hours trying to make them work to no avail. So what am i supposed to do?

 

by: carrzkissPosted on 2009-11-09 at 01:26:19ID: 25774445

Why?
Explain to me why it works for everyone else on GoDaddy and other servers
But does not work for you.

Put my code that I provided for you, and post a link to it here, and let me see it not working.
Once I see that it is not working, then I will gladly step away and let you be.

Show me a link.
Carrzkiss

 

by: itkamisamaPosted on 2009-11-09 at 07:37:20ID: 25776796

http://www.kc-samuraichef.com/cfs/testnews2.asp
http://www.kc-samuraichef.com/cfs/testnews.asp

On the first one it tells me that is not a valid path. I even called Godaddy to double check on the absolute hosting path and they confirmed that it was correct.

If you know what is wrong with it and know what needs to be done to fix it, I will gladly change my answer.

 

by: carrzkissPosted on 2009-11-09 at 10:53:06ID: 25778767

Show the me connection for both links that you are using.
Show them in the order of which you have the links here.
We will figure this out, GoDaddy is not different than any other server and I DO NOT give up!

 

by: itkamisamaPosted on 2009-11-09 at 14:35:18ID: 25780873

Ok. I am totally game to figure this out.
Here is the first one

<%set objConn=Server.CreateObject("ADODB.Connection")
objConn.Provider="Microsoft.Jet.OLEDB.4.0 "
objConn.Open "D:/Hosting/2659428/html/cfs/access_db/news.mdb"
%>
                                              
1:
2:
3:
4:

Select allOpen in new window

 

by: itkamisamaPosted on 2009-11-09 at 14:36:08ID: 25780880

And here is the second one

<%
Set objConn = CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("news.mdb") & ";"
objConn.Open
%>

                                              
1:
2:
3:
4:
5:
6:

Select allOpen in new window

 

by: carrzkissPosted on 2009-11-09 at 15:09:24ID: 25781063

There is nothing wrong with this one. http:#a25780880
Try this below, this assumes that your database is actually located in the folder named:
access_db

Let me know?

<%
Set objConn = CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
Server.MapPath ("access_db/news.mdb") & ";"
objConn.Open
%>
                                              
1:
2:
3:
4:
5:
6:

Select allOpen in new window

 

by: carrzkissPosted on 2009-11-09 at 15:13:17ID: 25781093

Now, lets look @  http:#a25780873
This is a physical location, and they stated that it was like that.

Create a new page, and add this to it. Save it to the  Folder:
access_db

Then run the page on the server.

<%=Request.ServerVariables("APPL_PHYSICAL_PATH")%>

This will give you your actual Physical Path

See if it it:   D:/Hosting/2659428/html/cfs/access_db/
Then that is what will display to the page.

Let me know.
Carrzkiss

 

by: itkamisamaPosted on 2009-11-09 at 17:43:18ID: 25781781

For the first one:
http://www.kc-samuraichef.com/cfs/testnews.asp

Still get an error.

 

by: itkamisamaPosted on 2009-11-09 at 17:48:17ID: 25781793

As to the second one, this is interesting.
http://www.kc-samuraichef.com/access_db/test.asp

Doesn't look anything like they told me.

 

by: itkamisamaPosted on 2009-11-09 at 17:58:41ID: 25781825

So I replace the the connection string in the second one with the one that should be correct (above).
Now I have new problems. I think it does connect to the db but the rest of the code is not working now.

Is it time to throw my hands up in the air?

 

by: carrzkissPosted on 2009-11-09 at 18:07:11ID: 25781852

OK, lets look at something shall we?
This is the Physical Path:   d:\hosting\masudam\access_db\

Now. For your connection string, it will be:

<%set objConn=Server.CreateObject("ADODB.Connection") objConn.Provider="Microsoft.Jet.OLEDB.4.0 " objConn.Open "d:\hosting\masudam\access_db\news.mdb" %>

OK.
Now.
For the other

<% Set objConn = CreateObject("ADODB.Connection") objConn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _ Server.MapPath ("access_db/news.mdb") & ";" objConn.Open %>

Lets look at this string now.
#1: If your root folder is:  masudam
You connection will be:   access_db/news.mdb

If you are getting any errors, please show me the errors that you are getting, as well as a link to see it.

Carrzkiss

 

by: carrzkissPosted on 2009-11-09 at 18:18:25ID: 25781896

I like this error
http://www.kc-samuraichef.com/cfs/testnews2.asp

Show me your code for this one.

 

by: itkamisamaPosted on 2009-11-09 at 21:53:45ID: 25782725

Alright. But I have to admit I cheated.
As I stated in the beginning, it's been years since I used ASP and I am having trouble remembering it.
And the site has to be completed by next week ( no pressure ha!)
So I used dreamweaver.... but here it is

<%set objConn=Server.CreateObject("ADODB.Connection")
objConn.Provider="Microsoft.Jet.OLEDB.4.0 "
objConn.Open "D:/Hosting/masudam/access_db/news.mdb"
%>
<%
Dim newsfeed
Dim newsfeed_numRows
 
Set newsfeed = Server.CreateObject("ADODB.Recordset")
newsfeed.Source = "SELECT * FROM tblNews"
newsfeed.CursorType = 0
newsfeed.CursorLocation = 2
newsfeed.LockType = 1
newsfeed.Open()
 
newsfeed_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
 
Repeat1__numRows = 5
Repeat1__index = 0
newsfeed_numRows = newsfeed_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName 
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
 
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
 
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
 
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
 
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
 
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next
 
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next
 
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then 
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "")  Then
  MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
 
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<html>
<body>
	<p class="smallheading">NEWS</p>
	<ul>
      <% 
While ((Repeat1__numRows <> 0) AND (NOT newsfeed.EOF)) 
%>
      <li><A HREF="news.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "nId=" & newsfeed.Fields.Item("nId").Value %>"><%=(newsfeed.Fields.Item("nTitle").Value)%></A></li>
      <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  newsfeed.MoveNext()
Wend
%>
 
	    </ul>
</body>
</html>
 
<%
newsfeed.Close()
Set newsfeed = Nothing
%>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:

Select allOpen in new window

 

by: carrzkissPosted on 2009-11-09 at 22:39:41ID: 25782914

This needs to be changed

<%set objConn=Server.CreateObject("ADODB.Connection")
objConn.Provider="Microsoft.Jet.OLEDB.4.0 "
objConn.Open "D:/Hosting/masudam/access_db/news.mdb"
%>

Change it to

<%set objConn=Server.CreateObject("ADODB.Connection") objConn.Provider="Microsoft.Jet.OLEDB.4.0 " objConn.Open "d:\hosting\masudam\access_db\news.mdb" %>

Once you change this, run the page again, and let me know what you get?

-------------------
Since you are just getting back into ASP I will not tell you that DW is the worst thing in the world to use for ASP Generated code.
Once you get back into the groove again, you need to start hand-coding.
It is a lot better and cleaner than what you are using.

*I use DWCS3 to design my layout, ONLY! I handcode all my CSS attributes and ALL my ASP/SQL coding*
------------------------
Carrzkiss


 

by: itkamisamaPosted on 2009-11-10 at 13:20:44ID: 25789995

New error :(

Generally I hand code all my pages and I used to do it in ASP  but in the last view years I have become more friendly with PHP. So now looking at it I just am having a tough time remembering what I did.

Microsoft VBScript compilation error '800a0401'

Expected end of statement

/cfs/testnews2.asp, line 2

set objConn=Server.CreateObject("ADODB.Connection") objConn.Provider="Microsoft.Jet.OLEDB.4.0 " objConn.Open "d:\hosting\masudam\access_db\news.mdb"
----------------------------------------------------^


If i seperate the statement
I get this

ADODB.Recordset error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/cfs/testnews2.asp, line 10

<%set objConn=Server.CreateObject("ADODB.Connection") 
objConn.Provider="Microsoft.Jet.OLEDB.4.0 " 
objConn.Open "d:\hosting\masudam\access_db\news.mdb" %>
<%
Dim newsfeed
Dim newsfeed_numRows
 
Set newsfeed = Server.CreateObject("ADODB.Recordset")
newsfeed.ActiveConnection = connectstring
newsfeed.Source = "SELECT * FROM tblNews"
newsfeed.CursorType = 0
newsfeed.CursorLocation = 2
newsfeed.LockType = 1
newsfeed.Open()
 
newsfeed_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
 
Repeat1__numRows = 5
Repeat1__index = 0
newsfeed_numRows = newsfeed_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName 
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
 
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
 
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
 
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
 
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
 
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next
 
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next
 
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then 
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "")  Then
  MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
 
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<html>
<body>
	<p class="smallheading">NEWS</p>
	<ul>
      <% 
While ((Repeat1__numRows <> 0) AND (NOT newsfeed.EOF)) 
%>
      <li><A HREF="news.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "nId=" & newsfeed.Fields.Item("nId").Value %>"><%=(newsfeed.Fields.Item("nTitle").Value)%></A></li>
      <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  newsfeed.MoveNext()
Wend
%>
 
	    </ul>
</body>
</html>
 
<%
newsfeed.Close()
Set newsfeed = Nothing
%>
                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:

Select allOpen in new window

 

by: carrzkissPosted on 2009-11-10 at 14:29:11ID: 25790616

Try this and let me know what you get

<%set objConn=Server.CreateObject("ADODB.Connection") 
objConn.Provider="Microsoft.Jet.OLEDB.4.0 " 
objConn.Open "d:\hosting\masudam\access_db\news.mdb" %>
<%
Dim newsfeed
Dim newsfeed_numRows
 
Set Getfeed = CreateObject("ADODB.Command")
Getfeed.ActiveConnection=connectstring
Getfeed.Prepared = true
Getfeed.CommandText = "SELECT * FROM tblNews"
set newsfeed = Getfeed.execute
 
 
newsfeed_numRows = 0
%>
<%
Dim Repeat1__numRows
Dim Repeat1__index
 
Repeat1__numRows = 5
Repeat1__index = 0
newsfeed_numRows = newsfeed_numRows + Repeat1__numRows
%>
<%
Dim MM_paramName 
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters
 
Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth
 
Dim MM_removeList
Dim MM_item
Dim MM_nextItem
 
' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then
  MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If
 
MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""
 
' add the URL parameters to the MM_keepURL string
For Each MM_item In Request.QueryString
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepURL = MM_keepURL & MM_nextItem & Server.URLencode(Request.QueryString(MM_item))
  End If
Next
 
' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
  MM_nextItem = "&" & MM_item & "="
  If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
    MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_item))
  End If
Next
 
' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
If (MM_keepBoth <> "") Then 
  MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL <> "")  Then
  MM_keepURL  = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm <> "") Then
  MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If
 
' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
  If (firstItem <> "") Then
    MM_joinChar = "&"
  Else
    MM_joinChar = ""
  End If
End Function
%>
<html>
<body>
	<p class="smallheading">NEWS</p>
	<ul>
      <% 
While ((Repeat1__numRows <> 0) AND (NOT newsfeed.EOF)) 
%>
      <li><A HREF="news.asp?<%= Server.HTMLEncode(MM_keepURL) & MM_joinChar(MM_keepURL) & "nId=" & newsfeed.Fields.Item("nId").Value %>"><%=(newsfeed.Fields.Item("nTitle").Value)%></A></li>
      <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  newsfeed.MoveNext()
Wend
%>
 
	    </ul>
</body>
</html>
 
<%
newsfeed.Close()
Set newsfeed = Nothing
%>

                                              
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:

Select allOpen in new window

 

by: itkamisamaPosted on 2009-11-10 at 16:44:11ID: 25791526

it didn't like it

ADODB.Command error '800a0bb9'

Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

/cfs/testnews2.asp, line 9

 

by: carrzkissPosted on 2009-11-10 at 17:14:18ID: 25791647

send me over a demo copy of your database.
I am going to get it to work on my end, if it works on my computer and on my server
Then it WILL work on yours.
I just need a copy of your access database (A sample, with just a couple of records)

 

by: itkamisamaPosted on 2009-11-11 at 20:01:20ID: 25801409

Sorry for the late response.

All I have in there right now is test data anyways.

 

by: carrzkissPosted on 2009-11-11 at 20:21:02ID: 25801480

here you go
http://ee.cffcs.com/Q_24869766/Q_24869766.asp
code
http://ee.cffcs.com/Q_24869766/Q_24869766.zip

The connectionstring name was not spelled correctly.

Let me know if you have any other issues.
Carrzkiss

 

by: itkamisamaPosted on 2009-11-12 at 16:30:26ID: 31649829

You are a genius

 

by: carrzkissPosted on 2009-11-12 at 17:14:25ID: 25810520

Glad that you are working now.
Once you get use to use the scripts, you will notice that simple things
Can sometimes cause the most annoying aggrivation.

Have a good one [itkamisama]
Carrzkiss


Author Comments:
You are a genius

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...