How to connect the SQL Server Database From Flex

412 views
Skip to first unread message

Sunil kumar Pidugu

unread,
Nov 9, 2007, 7:30:51 AM11/9/07
to flex_...@googlegroups.com
Dear Friends,
 
Happy Diwali to all, is there any one know how to connect the Sql Server Database from Flex.
I want to connect the Sql Server Database and insert ,update and delete the data.
 
 
could please send me suggestions or examples.
 
 
Thanks advance
 
 
Regards
P.Sunil Kumar
 
 

udayms

unread,
Nov 9, 2007, 11:31:37 AM11/9/07
to flex_...@googlegroups.com
I hope u do plan to use something on the backend like php/jsp/asp...?

dinesh

unread,
Nov 9, 2007, 3:38:52 PM11/9/07
to Flex India Community
Check this out : http://devzone.zend.com/article/11-Integrating-Adobe-Flex-and-PHP

I hope this would answer all your queries.

Regards
Dinesh.

Abdul Qabiz

unread,
Nov 10, 2007, 3:16:23 AM11/10/07
to flex_...@googlegroups.com
You can now write MSSQL driver in actionscript and connect to MSSQL server directly from flex without any middleware :)

But that's a lot to do, so easier options are to use any server-side script (asp, php etc)



http://abdulqabiz.com/blog/
---------------------------------------

sandin 4u

unread,
Nov 13, 2007, 1:06:22 AM11/13/07
to flex_...@googlegroups.com

hii..i was really trying to find answer to this myself for a long time and finally got it....hope this will help..below i give the code for a simple register page that i had did in my website..


<?php

$mysql = mysql_connect('localhost','sandin_sandin','sandhiya');

mysql_select_db( "sandin_quote" );                // here sandin_quote is the database name.

$name = $_POST['name'];
$username = $_POST['username'];
$password = $_POST['password'];
$email = $_POST['email'];
$gender = $_POST['gender'];
$bday = $_POST['bday'];
$country = $_POST['country'];
$secemail = $_POST['secemail'];
$per = $_POST['per'];
$know = $_POST['know'];
$dolike = $_POST['dolike'];
$sugg = $_POST['sugg'];

$query = "Insert into users values('$name','$username','$password','$email','$gender','$bday','$country','$secemail','$per','$know','$dolike','$sugg',1,'xyz','abc')";
$result = mysql_query($query);

print($result);

?>

save this as a php file.


see this is a simple php script that i use to insert into sql table...my table name is users...in the connect command in 2nd line has three arguments na, in that 1st argument is hostname,2nd is sql username and 3rd is sql password.

here is the mxml script..






    <mx:HTTPService id="reg" useProxy="false" method="POST" url="register.php" result="fncall(event)" />


in this in url u give the path to tat php file.

public function regg():void
            {
                 var n:String =namee.text;
                 var un:String = username.text;
                 var p:String = password.text;
                 var cp:String = cpassword.text;
                 var e:String = email.text;
                 var g:String = gender.selectedLabel;
                 var bd:String = bday.text;
                 var c:String = country.text;
                 var se:String = secemail.text;
                 var pers:String = per.text;
                 var k:String = know.text;
                 var d:String = dolike.text;
                 var s:String = sugg.text;
                 
                 var params:Object = {name:n,username:un,password:p,email:e,gender:g,bday:bd,country:c,secemail:se,per:pers,know:k,dolike:d,sugg:s};
                 reg.send(params);           
               
            }


this is the function that activates the php script...

hope u understand with this... if u cant understand tel me, i ll send u the full code.....

Abdul Qabiz

unread,
Nov 14, 2007, 5:46:06 AM11/14/07
to flex_...@googlegroups.com
Take care of SQL-Injection, you are directly inserting/executing the values to DB, I suggest you to validate it before inserting it to DB.

-abdul
--
-abdul
---------------------------------------
http://abdulqabiz.com/blog/
---------------------------------------

Sunil kumar Pidugu

unread,
Nov 20, 2007, 2:30:23 AM11/20/07
to flex_...@googlegroups.com
Thru the aspx page i want to connect the database. I want integrate with asp.net ..
please any sample send me .. atleast basic example to connect the database.

 

sri laxmi

unread,
Jul 15, 2012, 9:36:57 AM7/15/12
to flex_...@googlegroups.com
Hi I was unable to understand this code , can you give me full code for connecting the database in flex

sri laxmi

unread,
Jul 15, 2012, 9:38:04 AM7/15/12
to flex_...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages