Storing a URL in mysql database

Last post 04-08-2007 11:52 AM by pranavdbhatt. 0 replies.

Sort Posts:

  • Storing a URL in mysql database

    04-08-2007, 11:52 AM

    mysql does not store URL strings directly.

    for eg, this wont work.

    mysql.executenonquery("insert into images_table values('"+imageurltextbox.text+"') ;

    heres a workaround.

    before sending data to mysql, use urlencode.

    eg....

    string urlstr = httputility.urlencode(imageurltextbox.text) ;

    and then send it to database.

    to get it back use httputility.urldecode(string);

    One more thing. Images in .net recognize urls as ~\images\.....

    and not as c:\project\images\.....

    beware...

    Happy Programming Big Smile
     

    Filed under: , , ,
Page 1 of 1 (1 items)
Microsoft Communities
Page view counter