Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / July 2008



Tip: Looking for answers? Try searching our database.

Data retrieval  from MS SQLwith ASP.NET 2.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mzekeke - 04 Jul 2008 13:55 GMT
Can somebody provide   a simple example that gets data from  MS SQL /MysQL with
ASP.NET 2.0 and displays it in Flash without using Flash Remoting. Where you  
have a previous and next button  to scroll through the data  and displays it in
a textbox. I currently have the Foundation ASP.NET for Flash book  and find the
examples not useful for me as they use webservices are bit  too comprehensive
for me. On the Web most examples are for PHP/Flash or ASP/Flash and the only
ASP.NET example i found is for verifying a login.
Please help!
Mzekeke - 08 Jul 2008 14:55 GMT
Alright after exhaustively trying to get Flash/ASP.NET 2.0and MSSQL i almost
gave up until i ran across a tutorial at www.flash-db.com. Though the code was
in ASP i managed to get it converted with assistance to ASP.NET C#.
The bproblem i now face is that although the ASPX page compiles(with no
errors) and displays the data from the database when i run the flash movie
It displays nothing. I assumed that i wouldn't have to change the Actionscript
file as i sawthat  it's the same for ASP and PHP thus by extension thought it
should work fine also with ASP.net but it doesn't Anyway here's the code

Actionscript

//Create LoadVars object and load file
myData = new LoadVars()
//This is the line i changed to simply load the ASPX page
myData.load("Default.aspx")
myData.ref = this
//Fetch data
myData.onLoad = function(succes){
if(succes){
   for(var i=0; i<this.cant; i++){
    this.ref["Title_txt"+i].htmlText = "[B]"+this["Title"+i]+"[/B]"
    this.ref["Comments_txt"+i].text = this["Comments"+i]
    this.ref["holder_mc"+i].loadMovie(this["Image"+i])
        }
    } else trace("Error loading data")
}
stop()[/CODE]

And the ASPX code
[CODE]   SqlConnection cn = new SqlConnection(@"Data
Source=LENOVO197\MSSMLBIZ;Initial Catalog=anastasio;Integrated Security=True");

        SqlCommand cmd = new SqlCommand("SELECT Title, Comments, Image FROM
titles");
        cmd.CommandType = CommandType.Text;
        cmd.Connection = cn;
        cn.Open();
        SqlDataReader reader = cmd.ExecuteReader();

        int cont = 0;
        while (reader.Read())
        {
            Response.Write("Title" + cont.ToString() + "=" + reader["Title"]
                 + "&" + "Comments" + cont + "=" + reader["Comments"]+ "&" +
"Image"
                 + cont.ToString() + "=" + reader["Image"] + "&");
            cont = cont + 1;
        }
        Response.Write("cont=" + cont.ToString());
        cn.Close();
    }
}[/CODE]

Please help
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.