Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Android + C# + SQL Server 2008

$
0
0

Hi world, i am using this code to get info from my sql server 2008. this is working well in "Debug" mode but cannot run app in mobile(only release work for mobile) SO when i wanna to (Release mode) release it (.apk) and send to my samsung android mobile ,and when i run the app and click on button i get error : Unhandled Exception CODEPAGE=”1256″ not supported

i think it doesnt support IDbConnection in Release !

and my code is :

void button_Click(object sender, EventArgs e) {

            TextView txts = FindViewById<TextView>(Resource.Id.txt);
            txts.Text = "Salam Ali Joon !";
            string namess = "";
            string connectionString = "Server=217.66.216.77,1633;" +

                "Database=testinDB;" + "User ID=testing;" + "Password=arew;";
            try
            {    
        IDbConnection dbcon;
            using (dbcon = new SqlConnection(connectionString))
            {
                dbcon.Open();  
                using (IDbCommand dbcmd = dbcon.CreateCommand())
                {
                    string sql = " SELECT * " +
                                 " FROM persons.[user] ";
                    dbcmd.CommandText = sql;
                    using (IDataReader reader = dbcmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            string FirstName = (string)reader["UserName"];
                            namess = "user name is : " + FirstName;
                            //string LastName = (string)reader["LastName"];
                            //namess += "Name: " +FirstName + " " + LastName;
                        }
                        reader.Close();
                        dbcon.Close();
                    }
                }
            }
            txts.Text = namess;
        }
        catch (Exception ex)
        {
            txts.Text = ex.Message;
        }
    }

HELP Please !


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>