开发者

mysql % due to spaces in db filepath

开发者 https://www.devze.com 2023-02-17 05:31 出处:网络
why doesnt mysql deal with spaces and how do I combat it? if i have a path name in the db with spaces it puts a % in place of the space which then isnt functional?

why doesnt mysql deal with spaces and how do I combat it?

if i have a path name in the db with spaces it puts a % in place of the space which then isnt functional?

public partial class UserProfile : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {

        OdbcConnection cn = new OdbcConnection("Driver={MySQL ODBC 3.51 Driver}; Server=localhost; Database=gymwebsite; User=root; Password=commando;");
        cn.Open();

        OdbcCommand cmd = new OdbcCommand("SELECT User.FirstName, User.SecondName, User.Aboutme, User.DOB, Pictures.picturepath FROM User LEFT JOIN Pictures ON User.UserID = Pictures.UserID WHERE User.UserID=1", cn);
        OdbcDataReader reader = cmd.ExecuteReader();
        while (reader.Read())
  开发者_C百科      {
            Name.Text = String.Format("{0} {1}", reader.GetString(0), reader.GetString(1));
            Aboutme.Text = String.Format("{0}", reader.GetString(2));
            Age.Text = String.Format("{0}", reader.GetString(3));
            Image1.ImageUrl = String.Format("{0}", reader.GetString(4));
        }


    }
}

output:

<div class="image">
                                                <a href="#"></a>
                                                <img style="border-width: 0px;" src="C:\Users\Public\Pictures\Sample%20Pictures" id="ctl00_ContentPlaceHolder1_Image1">
                                                &nbsp;</div>

character set in mysql is latin 1 and swedish something or other unsure how to find it again?


I think your problem is Image1.ImageUrl. That definitely will URL encode the string that gets passed to it.

0

精彩评论

暂无评论...
验证码 换一张
取 消