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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

asp :create a access table within the asp code

Status
Not open for further replies.

neelawathura

Programmer
Joined
Jun 18, 2003
Messages
7
Location
LK
Can some one help me in creating a MS access table within the asp code itself.
 
Try this...
Code:
<%
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open(YourDBConnectionString)

strCreateSQL = "CREATE TABLE myTable (myField1 int, myField2 varchar, myField3 varchar, myField4 bit)"

objConn.Execute(strCreateSQL)

Set objConn = Nothing
%>

Tony
________________________________________________________________________________
 
Hey FesterSXS It Worked.Thanks

May i ask another question .How to retrieve the field names from that table.
 
Not tried that before but maybe something like this...
Code:
<%
strSQL = "SELECT TOP 1 FROM myTable;"

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, YourDBConnectionString

If NOT objRS.EOF Then
  For Each item in objRS.Fields
    Response.Write item & "<BR>"
  Next
End If

Set objRS = Nothing
%>
Of course - you could always store the field names into variables before you create the table. Then you can use these stored field names when it comes to extracting information.

Tony
________________________________________________________________________________
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top