Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create table in local db

Status
Not open for further replies.

JackD4ME

Programmer
Jun 4, 2002
228
US
i am running a small program where i need to create a table on the c: through asp. is this possible and if so, how?

thanks,
jack
 
Maybe it's beyond my ken, but you need to create a table on the C drive? Or do you mean a file? Not that I've ever tried that, either, but could you use FSO?

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
did u mean to create a table in some kind of database on c drive??

or are you just talking bout creating a table on the c drive ( no database stuff)...then i think you are talking about creating a text file with the data in it...

i am not completely sure of what you are trying to do...

-DNG
 
I need to create a table in a database on the c: drive. sorry about the clarification.
 
You should just be able to open your database and then run some SQL code (providing it's an SQL database or, if not, then whatever the equivalent might be) that will create your table. Is your question how to write the SQL to create the table or how to connect to the database?

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
I have the sql to create the table on the server db. I just need to create it on a local db.
 
Provided that the local db already exists, simply establish a connection to it and then run your SQL code to create the new table. Are you encountering a specific error with your code?

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
I believe that the problem lies in that asp is server side and cannot write to a local drive through a server connection.

This code:

Set pConn = Server.CreateObject("ADODB.Connection")
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
DSNtemp=dsntemp & "DBQ=c:\forms.mdb"
pConn.Open DSNtemp '<----line 6

Results in this error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x3d4 Thread 0x7cc DBC 0x20f9014 Jet'.
/cidweb/bnz/frmPermit.asp, line 6
 
I do not think that should be an issue (but if I'm wrong, hopefully someone will correct me). Try this MS KB article and see if it helps you to fix it.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Wait, when you mean local do you mean the client's machine? (ie, the one they are using the browser from to access your webserver)

If thats the case, then yes, you cannot do it with ASP.

signature.png
 
Yes, the client machine. It has been a long time since I found dsn-less connections and wondered if they were able to do that yet. what would you recommend to write to the client db?
 
Unless they are running an actual database (not a file-based system like MS Access, CSV, whatever) then connecting will be difficult to impossible.
If you can share over to the folder the database file is in, then you just have to setup permissions for the IUSR_machine user to access the folder and file and write permission as well. Then you can use a normal connection string with a share path or mapped drive.
If they are running a real database, then a normal connection string should work just fine.

If neither of the above is possible, then you will need to either:
a) Supply a script/application for them to download and run
b) Make an ActiveX object
c) Create a form for them to upload the database, then change it, then send it back down to them
d) If it's MS Access, create a module in the database to use the XMLHTTP object everytime it is opened to open an ASP page on your server that dumps a list of SQL statements (basically a change log) to execute in order to get it up to date
e) If it's MS Access and your server has a real DB, create a linked table so that it will pull it's data back from your table
f) If both are MS Access force your user to download a new copy of the DB when you change the schema

-T

signature.png
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top