|
|||
|
Hi guys!!
First off great software and great forum!! I tried creating a sample application. It was setup this way. Database: MS SQL Server 2005 Express Edition Flash frontend: textbox1 named 'connstr' textbox2 named 'msgs' textbox3 named 'infos' button1 --> fscommand("FFish_Run", "dologin"); button2 --> fscommand("FFish_Run", "displayinfo"); FFish Scripts Code:
//dologin
var conn = new ActiveXObject("ADODB.Connection");
var pla = new FlashPlayer;
pla.bindData("connstr.text");
pla.updateData(true);
var str = pla.connstr.text;
FlashPlayer.setVariable("_root.msgs",str);
var connected = false;
conn.ConnectComplete = function (err, arg1, arg2)
{
if (err != undefined)
{
FlashPlayer.setVariable("_root.msgs",err.Description);
return;
}
connected = true;
}
//Contect to the database
conn.open(str);
if (!connected){
FlashPlayer.setVariable("_root.msgs","Failed to connect to the DB");
return;
}else{
FlashPlayer.setVariable("_root.msgs","Successfully Connected!!");
return;
}
Code:
//displayinfo
var rs = new ActiveXObject("ADODB.Recordset");
rs.open("Select * from testb", conn, 1, 2);
rs.moveFirst();
var testmsg=rs.Fields["name"].Value;
FlashPlayer.setVariable("_root.infos", testmsg);
PS. What Connection String should i use to connect to SQL Server 2005 Express Edition |
|
|||
|
The following web page explains how to use connection strings:
http://www.asp101.com/articles/john/...ng/default.asp The connection string for sql server 2005 should be something like "Provider=SQLOLEDB; Data Source=localhost; Initial Catalog=mydb; User ID=username; Password=password;" |
|
|||
|
Tnx for the quick reply
![]() So there isnt anything wrong with the code im using? What if im using windows authentication? Could i just leave out the User name and Password parameters?(the link you gave me didnt say) e.g "Provider=SQLOLEDB; Data Source=localhost; Initial Catalog=mydb;" Tnx for the help so far and pardon me being a noob at this ![]() |
|
|||
|
Please try the method introduced in the following article:
http://support.microsoft.com/default...b;en-us;265808 |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|