473,395 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

HELP! Retriving field names and properties from MS Access database using ASP

Hi everyone!

I have a really frustrating error and need help.
I’m trying to do a function that gets the properties and names
of the fields in a MS Access database using ASP. I haven’t
programmed in a while so I’m quite lost.

Once I have the my database structure I will insert the corresponding
fields from a web form but the database is huge and I want to be able
to change the database and form without changing the ASP code all the
time.

This is my function that is not working yet. I cant seem to connect
properly to the database...

Function InsertDataBase()
'# I connect with Conn earlier which works fine.

Dim Rec
Set Rec = Server.CreateObject("ADODB.Record")
Dim Fld

DBUrl = Server.MapPath("/_Data/Mydb.mdb") '#
"http://myserver/_Data/Mydb.mdb"

'# Get the database structure
Dim ConnDir
Set ConnDir = Server.CreateObject("ADODB.Connection")
Response.write Server.MapPath("/_Data/")
'ConnDir.Provider = "ExOLEDB.DataSource" '# This row gives the error:
Provider cannot be found. It may not be properly installed.
ConnDir.Open "http://myserver/_Data" '# This row (_Data is a
directory) gives the error: [Microsoft][ODBC Driver Manager] Data
source name not found and no default driver specified
Rec.Open "http://myserver/_Data/Mydb.mdb", ConnDir

'Rec.Open DBUrl, Conn, adModeReadWrite

'# Validate each field according to the structure and create SQL
statement
strSQL = "INSERT INTO Andres ( "
strVALUES = ""
For Each Fld in Rec.Fields
Response.write "<BR>Fieldsssss: " & Fld.Properties(.Name) & " " &
Fld.Properties(.Type) & " " & Fld.Properties(.Size)
strSQL = strSQL & "[" & Fld.Properties(.Name) & "], "

strVALUES = strVALUES & "'" & validate(
Reqsafe(Fld.Properties(.Name)), Fld.Properties(.Type),
Fld.Properties(.Size) ) & "', "

Next
strSQL = Left( strSQL, len(strSQL)-2) ' Removes the last ", "
strVALUES = Left( strVALUES, len(strSQL)-2) ' Removes the last ", "
strSQL = strSQL & " ) VALUES ( " & strVALUES
Rec.Close

'# Execute SQL statement
set rs = conn.execute(strSQL)

End Function

I would really appreciate all help or suggestions I can get!!! Thanks
in advance!

Patricio
Nov 12 '05 #1
0 2922

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Dave | last post by:
After following Microsofts admonition to reformat my system before doing a final compilation of my app I got many warnings/errors upon compiling an rtf file created in word. I used the Help...
9
by: Tom | last post by:
A question for gui application programmers. . . I 've got some GUI programs, written in Python/wxPython, and I've got a help button and a help menu item. Also, I've got a compiled file made with...
4
by: Sarir Khamsi | last post by:
Is there a way to get help the way you get it from the Python interpreter (eg, 'help(dir)' gives help on the 'dir' command) in the module cmd.Cmd? I know how to add commands and help text to...
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
0
by: Yabedabe | last post by:
Hello there, I have a strange problem (possible bug?) to display two HTML Help files at the same time. To reproduce this problem. Create a new VB.Net solution. Place two buttons on the form....
3
by: lord.zoltar | last post by:
I've managed to get a nice little chm help system written. Now I need to display it! I added a HelpProvider to my MDIParent form and set the namespace of the HelpProvider to be the help file. So...
1
by: gordon | last post by:
Hi I have an app that i have written a chm help file for. What is the best way to associate that with my help menu and the F1 key. I have added the file to the project already, just not sure...
1
by: trunxnirvana007 | last post by:
'UPGRADE_WARNING: Array has a new behavior. Click for more: 'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="9B7D5ADD-D8FE-4819-A36C-6DEDAF088CC7"' 'UPGRADE_WARNING: Couldn't resolve...
0
by: hitencontractor | last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003. I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About. The application...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.