:: Forum >> Version 1 >>

How to connect to SQL and Access

Can you use this tool to connect to and ODBC connection?

Thank you
Gene Arnold
Gene
Wednesday, January 7, 2004
try building the array dynamically when you create the page, and then use the array in the javascript. I did this with sql server and asp.
nt
Wednesday, January 7, 2004
I hate to sound like such a dummy but do you mean build the array with VB Script on and ASP page? I never really mixed VB Script and Java Script together on the same page or am I just completely missing the boat which would not be uncommon. I think you mean you want me to build the array with Java Script on an ASP page then use the results on the grid. If that is the case would you be kind enough to offer an example to help me get started. I understand that these are really basic questions and don't blame you for feeling like your waisting your time with a knuckle head like me but an example would be great. You could even email it to me at garnold@tfbbiking.com. Thank you so much for your help!
Thursday, January 15, 2004
ok, I'll try to make an example. I was hesitating to do so because there are so many different server-side technologies and I'm not an expert on any of them. Probably ASP (VB Script) and PHP is what most people are using, right?
Alex (ActiveWidgets)
Thursday, January 15, 2004
the beauty of web design and html is that you arn't limited to one type of language on a web page, you can blend asp, javascript, php, and jsp (java) all on the same page, and the browser will render it correctly. Try something like this

<script javascript>
<%
dim sql
sql = connection string.....and query
response.write("var myarray=[")
for x = 0 to ubound sql(0,i)
response.write("[" & sql(2,i) & "]")
next
%>
ActiveWidgets stuff goes here
</script>


that's a rough sketch, don't take it word for word,but you should get the idea
nt
Monday, January 19, 2004
Actually if you're looking for connecting to a database, there's a project I've found which seems much more suited. check out http://dhtmlgrid.sourceforge.net

You just build your table like you normally would in html, and then the javascript just takes care of everything in the background. You can alter the apearance to look like ActiveWidgets with style sheets.
nt
Monday, January 19, 2004
Yeah, well, your column headers scroll out of the div, and you cannot resize the columns. That is probably why most of us are looking at using the ActiveWidgets method for implementation.
Mobasoft
Monday, August 30, 2004
<script javascript>
<%
dim sql
sql = connection string.....and query
response.write("var myarray=[")
for x = 0 to ubound sql(0,i)
response.write("[" & sql(2,i) & "]")
next
%>
ActiveWidgets stuff goes here
</script>
Monday, February 21, 2005
- I see code, but not understand...

some body explain me, how conect to SQL with javascript ?

emc.
emerino@cybercable.net.mx
Monday, February 21, 2005
You don't connect with a database using Javascript.

ASP renders the page BEFORE Javascript gets it's turn. Thus, if you connect to the database, and response.write the correct array data for Javascript, at the end-user, he/she will only see the array you created dynamically within the Javascript, and Javascript would fire accordingly because it fires AFTER you did your ASP magic.

Open your mind... most of the times when people don't understand this concept is because they've been " taught " a certain way.
AcidRaZor
Monday, February 21, 2005
Here is the simplest example to get you started. You just need to change the ODBC connection and table information to match yours.
------------------------------------

<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
<html>
<head>
<style>
body, html {margin:0px; padding: 0px; overflow: hidden;font: menu;border: none;} </style>
<link href="../../runtime/styles/xp/grid.css" rel="stylesheet" type="text/css" ></link>
<script src="../../runtime/lib/grid.js"></script>
<!-- #INCLUDE FILE="activewidgets.asp" -->
</head>
<body>

<%
Dim oConnection, oRecordset
Set oConnection = Server.CreateObject("ADODB.Connection")
oConnection.Open "IntranetSQL"
Set oRecordset = oConnection.Execute("SELECT * FROM Employees")

Response.write(activewidgets_grid("obj", oRecordset))

'Alternate method via recordset
'do while not oRecordset.eof
'str = str & oRecordset("FirstName") & "," & oRecordset("LastName") & vbCrlf
'movenext
'loop

oRecordset.close
Set oRecordset = nothing
oConnection.close
Set oConnection = nothing
%>

</body>
</html>
Jorge
Friday, August 26, 2005
How to connect to MySql by using JavaScript?
Veena
Monday, November 7, 2005



This topic is archived.

Back to support forum

Forum search