ASP,ACCESS SHOW TABLES COLUMN NAME

38 views
Skip to first unread message

m.nedim...@gmail.com

unread,
Aug 31, 2015, 9:22:43 AM8/31/15
to
I want to draw a line from the classic asp to access database information.
I mean the name field in a table you want to assign to variables.

Evertjan.

unread,
Aug 31, 2015, 9:34:27 AM8/31/15
to
m.nedim...@gmail.com wrote on 31 Aug 2015 in
microsoft.public.inetserver.asp.general:

> I want to draw a line from the classic asp to access database information.

Lines are not methods to access a database.

> I mean the name field in a table you want to assign to variables.

What is a "name field"?

=====================================

A *database* consists of *tables*, each consisting of *records*.

Each *record* in a given *table* has the same number of *fields*

Each given *field* is of certain *type*,
and if that type is *string* of a maximum *length*

Each *database*,
each *table*,
and each *column of fields*
has a name.

Please restate what you want within the above framework.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

mehmet nedim akgül

unread,
Aug 31, 2015, 10:16:18 AM8/31/15
to
I want to get their names on the line

The image links available
http://i.hizliresim.com/aDgEd5.png

mehmet nedim akgül

unread,
Aug 31, 2015, 10:22:44 AM8/31/15
to
database name: veritabanim.mdb

table name: table1

columns names: "Column names while writing code should come from the outside.
Column names must act like we know not we"

mehmet nedim akgül

unread,
Aug 31, 2015, 10:30:33 AM8/31/15
to
SELECT Name FROM MSysObjects WHERE (Left([Name],1)<>'~') AND (Left([Name],4)<>'MSys') AND ([Type] In (1, 4, 6)) ORDER BY Name;

It makes me all the table names in the database listing these codes.

I want to list the names of the columns of this table like this.

Evertjan.

unread,
Aug 31, 2015, 1:27:47 PM8/31/15
to
mehmet nedim akgül <m.nedim...@gmail.com> wrote on 31 Aug 2015 in
microsoft.public.inetserver.asp.general:

> SELECT Name FROM MSysObjects WHERE (Left([Name],1)<>'~') AND
> (Left([Name],4)<>'MSys') AND ([Type] In (1, 4, 6)) ORDER BY Name;
>
> It makes me all the table names in the database listing these codes.

does it?

> I want to list the names of the columns of this table like this.

1 this is usenet, not email, do if you respond on something,you should quote
that like I do now.

What do you mena with "names of the columns", the contents of the fields,
or the name of the column, well you know that already, that is [Name]

3 "like this" like what? Please respond by giving some example of your
serverside code, and tell us where you go wrong.

> SELECT [Name] FROM MSysObjects WHERE (Left([Name],1)<>'~') AND
> (Left([Name],4)<>'MSys') AND ([Type] In (1, 4, 6)) ORDER BY Name;

MSysObjects is the name of a table, not the name of the database-file.
[Name] is the name of a field.
Show us how you want to loop through the records, using vbs or js.

Mehmet Nedim AKGUL

unread,
Aug 31, 2015, 3:05:13 PM8/31/15
to
----------------------------------------------------------------------------



<%
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("veritabanim.mdb"))
ssql="select column_name,* from information_schema.columns where table_name = 'tabloadi' order by ordinal_position;"
Set oRS = oConn.Execute(sSQL)

Do While NOT oRS.EOF

%>
<br>
<%

oRS.MoveNext
Loop

oConn.Close
Set oRS = Nothing
Set oConn = Nothing
%>


Script error detected at line 5.
Source line: Set oRS = oConn.Execute(sSQL)
Description: [Microsoft][ODBC Microsoft Access Driver] Could not find file 'C:\Users\nedim\Desktop\information_schema.mdb'.

Evertjan.

unread,
Aug 31, 2015, 7:04:08 PM8/31/15
to
Mehmet Nedim AKGUL <mnak...@gmail.com> wrote on 31 Aug 2015 in
microsoft.public.inetserver.asp.general:

> On Monday, August 31, 2015 at 8:27:47 PM UTC+3, Evertjan. wrote:
>> mehmet nedim akgül <m.nedim...@gmail.com> wrote on 31 Aug 2015 in
>> microsoft.public.inetserver.asp.general:
>>
>> > SELECT Name FROM MSysObjects WHERE (Left([Name],1)<>'~') AND
>> > (Left([Name],4)<>'MSys') AND ([Type] In (1, 4, 6)) ORDER BY Name;
>> >
>> > It makes me all the table names in the database listing these codes.
>>
>> does it?
>>
>> > I want to list the names of the columns of this table like this.
>>
>> 1 this is usenet, not email, do if you respond on something,you should
>> qu
> ote
>> that like I do now.
>>
>> What do you mena with "names of the columns", the contents of the
>> fields, or the name of the column, well you know that already, that is
>> [Name]
>>
>> 3 "like this" like what? Please respond by giving some example of your
>> serverside code, and tell us where you go wrong.
>>
>> > SELECT [Name] FROM MSysObjects WHERE (Left([Name],1)<>'~') AND
>> > (Left([Name],4)<>'MSys') AND ([Type] In (1, 4, 6)) ORDER BY Name;
>>
>> MSysObjects is the name of a table, not the name of the database-file.
>> [Name] is the name of a field.
>> Show us how you want to loop through the records, using vbs or js.

[please do not quote signatures on usenet]

> <%
> Set oConn = Server.CreateObject("ADODB.Connection")
> oConn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &
> Server.MapPath("veritabanim.mdb"))

> ssql="select column_name,* from
> information_schema.columns where table_name = 'tabloadi' order by
> ordinal_position;"

You cannot select a column-name like this
and the table-name has to be after the "from" keyword.

> Set oRS = oConn.Execute(sSQL)
>
> Do While NOT oRS.EOF
>
> %>
> <br>

What do you want to show here?

> <%
>
> oRS.MoveNext
> Loop
>
> oConn.Close
> Set oRS = Nothing
> Set oConn = Nothing
> %>
>
>
> Script error detected at line 5.

You do not show line numbers

> Source line: Set oRS = oConn.Execute(sSQL)
> Description: [Microsoft][ODBC Microsoft Access Driver] Could not find
> file 'C:\Users\nedim\Desktop\information_schema.mdb'.

However that error seems clear to me! The Database is not as described or
where described.

veritabanim.mdb
is not
information_schema.mdb

Try the ACE.OLEDB.12.0 driver:

======================
set CONNECT = server.CreateObject("ADODB.Connection")

CONNECT.Open "PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=" &_
Server.MapPath("/information_schema.mdb") & ";"

ssql = "...."

Set oRS = oConn.Execute(sSQL)
======================

========================
try this to get the column-names:

set rs = conn.Execute("select * from " & tableName)
for each column in rs.fields
Response.Write column.name & "<br>"
next
===============

Mehmet Nedim AKGUL

unread,
Sep 1, 2015, 3:55:38 AM9/1/15
to
------------------------------------------------------------------------
------------------------------------------------------------------------



<%
tableName="tabloadi"
set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open "PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=" &Server.MapPath("veritabanim.mdb") & ";"
ssql="select column_name,* from veritabanim.columns where table_name = 'tabloadi' order by column_name;"
Set oRS = CONNECT.Execute(ssql)

set rs = CONNECT.Execute("select * from " & tableName)
for each column in rs.fields
Response.Write column.name & "<br>"
next
CONNECT.Close
Set rs=Nothing
Set oRS = Nothing
Set CONNECT = Nothing
%>







Script error detected at line 5.
Source line: Set oRS = CONNECT.Execute(ssql)
Description: The Microsoft Office Access database engine cannot find the input table or query 'columns'. Make sure it exists and that its name is spelled correctly.

Evertjan.

unread,
Sep 1, 2015, 4:13:11 AM9/1/15
to
Mehmet Nedim AKGUL <mnak...@gmail.com> wrote on 01 Sep 2015 in
microsoft.public.inetserver.asp.general:

> <%
> tableName = "tabloadi"

Indeed it is a good thing to have table-names include
"tab" or "tbl" to discern them from fieldnames.
Additionally always use [] around fieldnames for the same reason,
(and to allow reserved words).

> set CONNECT = server.CreateObject("ADODB.Connection")

> CONNECT.Open "PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE="
> & Server.MapPath("veritabanim.mdb") & ";"

change " to "_ at a new line.

the & ";" part is not strictly necesary anymore

???
> ssql="select column_name,* from
> veritabanim.columns where table_name = 'tabloadi' order by column_name;"
> Set oRS = CONNECT.Execute(ssql)
???

SKIP the part between the ??? ???, this has no output whatever,
and the ssql string is incorrect.

Please do not just copy and paste,
but analize the code and learn from that.


> set rs = CONNECT.Execute("select * from " & tableName)

> for each column in rs.fields
> Response.Write column.name & "<br>"
> next

???2
> CONNECT.Close
> Set rs=Nothing
> Set oRS = Nothing
> Set CONNECT = Nothing
???2

SKIP the part between the ???2 ???2 when on a ASP-webpage
not incorrect but when the web-page closes
this is done anyway on any decent modern IIS-version.

Oh, now I will be crushed by the last purists on this NG.


> %>

Mehmet Nedim AKGUL

unread,
Sep 1, 2015, 4:39:46 AM9/1/15
to
--------------------------------------------------------
--------------------------------------------------------
Thanks baby :)

<%

set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open "PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=" &Server.MapPath("veritabanim.mdb") & ";"
ssql="select column_name,* from veritabanim.columns where table_name = tblad;"
set rs = CONNECT.Execute("select * from tblad")
for each column in rs.fields
Response.Write column.name & "<br>"
next
%>

output:
id
name
sname
phone

Thank you for your help . Working at the moment.

Evertjan.

unread,
Sep 1, 2015, 6:29:41 AM9/1/15
to
Mehmet Nedim AKGUL <mnak...@gmail.com> wrote on 01 Sep 2015 in
microsoft.public.inetserver.asp.general:

> <%
>
> set CONNECT = server.CreateObject("ADODB.Connection")
> CONNECT.Open "PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE="
> &Server.MapPath("veritabanim.mdb") & ";"

>ssql="select column_name,* from
> veritabanim.columns where table_name = tblad;"

Why this ssql line? It does not do a thing!!!

> set rs = CONNECT.Execute("select * from tblad")
> for each column in rs.fields
> Response.Write column.name & "<br>"
> next
> %>
>
> output:
> id
> name
> sname
> phone
>
> Thank you for your help . Working at the moment.
>



Mehmet Nedim AKGUL

unread,
Sep 1, 2015, 7:08:01 AM9/1/15
to
----------------------


Set oRS = CONNECT.Execute(sSQL)
it fails because this command.
Command was abolished and it worked .

Mehmet Nedim AKGUL

unread,
Sep 1, 2015, 7:18:29 AM9/1/15
to
-----------
ssql="select column_name,* from veritabanim.columns where table_name = tblad;"
I raised it

Mehmet Nedim AKGUL

unread,
Sep 1, 2015, 8:56:38 AM9/1/15
to
<%
response.write(session("tablo_adi"))
set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open "PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=" &Server.MapPath("veritabanim.mdb") & ";"
Set Tablom = server. CreateObject("ADODB.Recordset")
Tablom.Open session("tablo_adi"), CONNECT, 1, 3
Tablom.AddNew
set rs = CONNECT.Execute("select * from "& session("tablo_adi"))
i=1
for each column in rs.fields
Tablom(???????)=column.name
next
Tablom.Update
%>


Tablom(???????)=column.name
value ???: What should I write in this specified location ?

Mehmet Nedim AKGUL

unread,
Sep 1, 2015, 9:56:20 AM9/1/15
to
-------------------------------------
--------------------------------------

<%
response.write(session("tablo_adi"))
set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open "PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=" &Server.MapPath("veritabanim.mdb") & ";"
Set Tablom = server. CreateObject("ADODB.Recordset")
Tablom.Open session("tablo_adi"), CONNECT, 1, 3
Tablom.AddNew
set rs = CONNECT.Execute("select * from "& session("tablo_adi"))
i=1
for each column in rs.fields
Tablom(???????)=request(column.name)
next
Tablom.Update
%>


Tablom(???????)=request(column.name)

Evertjan.

unread,
Sep 1, 2015, 10:07:04 AM9/1/15
to
Mehmet Nedim AKGUL <mnak...@gmail.com> wrote on 01 Sep 2015 in
microsoft.public.inetserver.asp.general:

What do you want to accomplish,
that you cannot do without a recordset ?

Don't ever use a ADODB.Recordset,
until you know all the ins and outs of ADODB.Connection

Mehmet Nedim AKGUL

unread,
Sep 2, 2015, 2:35:53 AM9/2/15
to
----------------
I want to add records to the database .

Evertjan.

unread,
Sep 2, 2015, 3:05:13 AM9/2/15
to
Mehmet Nedim AKGUL <mnak...@gmail.com> wrote on 02 Sep 2015 in
microsoft.public.inetserver.asp.general:

>> What do you want to accomplish,
>> that you cannot do without a recordset ?
>>
>> Don't ever use a ADODB.Recordset,
>> until you know all the ins and outs of ADODB.Connection

[please do not quote signatures on usenet]

> I want to add records to the database .

There are days that I rather want someting too.

However, the ADODB.Recordset is not needed to add records.

The SQL "insert" command is enough.

Please read-up on SQL, this NG is no substitute for simple reading.

Don't ever use a ADODB.Recordset, until ... [see above]

Mehmet Nedim AKGUL

unread,
Sep 2, 2015, 4:03:22 AM9/2/15
to
for each column in rs.fields
SQLINSERT="INSERT INTO " &session("tablo_adi")& " "&" (" &column.name& ")" & "VALUES (" & request(column.name) & ") "
next

You write the correct use of it added ?

Evertjan.

unread,
Sep 2, 2015, 4:20:03 AM9/2/15
to
Mehmet Nedim AKGUL <mnak...@gmail.com> wrote on 02 Sep 2015 in
microsoft.public.inetserver.asp.general:

> for each column in rs.fields
> SQLINSERT="INSERT INTO " &session("tablo_adi")& " "&" (" &column.name&
> ")" & "VALUES (" & request(column.name) & ") "

sorry, this is far to complicated,
probably you will have to debug,
and I don't know what you plan to do,
and I am not going to quess.

It seems you are working with two different tables now?

Before each "next",
you would have to do an execute command:

set myData = myCommand.Execute(SQL)

> next


===============================

In general do this:

SQL = "blah blah etc etc"
response.write SQL & "<br>" : response.end
set myData = myCommand.Execute(SQL)

then, when you are satisfied that the SQL-string is as intended,
then remark-away the response.end like this

SQL = "blah blah etc etc"
response.write SQL & "<br>" : ''' response.end
set myData = myCommand.Execute(SQL)

and if all SQL's in the loop are correct
then remark-away the response.write like this:

SQL = "blah blah etc etc"
''' response.write SQL & "<br>" : ''' response.end
set myData = myCommand.Execute(SQL)


> You write the correct use of it added ?

Sorry, I don't understand the English of this sentence.

==========================

Mehmet Nedim AKGUL

unread,
Sep 2, 2015, 4:48:45 AM9/2/15
to
I want to transfer this data to the database

Mehmet Nedim AKGUL

unread,
Sep 2, 2015, 5:17:49 AM9/2/15
to
PAGE1:
<%
response.write(session("tablo_adi"))

set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("veritabanim.mdb"))
tblad=session("tablo_adi")
set rs = CONNECT.Execute("select * from "& tblad)
%>
<form action="tblveriekleonay1.asp" method="post">
<%
for each column in rs.fields

%>
<%=column.name%> &nbsp;<input type="text" name="<%=column.name%>"></br>
<%
next
%>
<input type="submit" name="gonder" value="kaydet">
</form>










PAGE:tblveriekleonay1.asp

<%
set CONNECT = server.CreateObject("ADODB.Connection")
CONNECT.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("veritabanim.mdb"))

set rs = CONNECT.Execute("select * from "& session("tablo_adi"))
for each column in rs.fields

!!! How do we transfer the entered text database

next


%>

Evertjan.

unread,
Sep 2, 2015, 11:58:58 AM9/2/15
to
Mehmet Nedim AKGUL <mnak...@gmail.com> wrote on 02 Sep 2015 in
microsoft.public.inetserver.asp.general:

> PAGE1:

This is not email, but usenet, so one to many posting.

You are not discussing according to the NG rules,
where you quote the significant part
of the posting you are responding on.

And you are not responding on my questions.

So I won't play anymore.
Reply all
Reply to author
Forward
0 new messages