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

problem inserting data in Sql Server in release mode

$
0
0

Hi, I am inserting data in Sql server successfully from my app in debug mode but it is neither working in release mode nor in a mobile device... I have checked the dlls in .apk by extracting it and there are all the dlls which I have added in my app. Here is my code:

protected void addUser(int id, string fbId, string name, string usrName, string mail, string dob, int isExist) 
            { 
                string conStr = SqlServerString.ConnectionString("myserver", "mydb", "userid", "pass"); 
                SqlConnection conn = new SqlConnection(conStr); 
                //try                { 
                    conn.Open(); 
                    SqlCommand cmd = new SqlCommand("Users_Insert", conn); 
                    cmd.CommandType = CommandType.StoredProcedure; 
                    cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int, 4)).Direction = ParameterDirection.Output; 
                    cmd.Parameters.AddWithValue("@FacebookId", fbId); 
                    cmd.Parameters.AddWithValue("@Name", name); 
                    cmd.Parameters.AddWithValue("@UserName", usrName); 
                    cmd.Parameters.AddWithValue("@Email", mail); 
                    cmd.Parameters.AddWithValue("@BornOn", dob); 
                    cmd.Parameters.Add(new SqlParameter("@IsExist", SqlDbType.TinyInt,1)).Direction = ParameterDirection.Output; 
                    cmd.ExecuteNonQuery(); 
                    id = (int)(cmd.Parameters["@Id"].Value); 
                    isExist = Convert.ToInt32(cmd.Parameters["@IsExist"].Value); 
                /*} 
                catch (Exception ex) 
                { 
                    parent.hText.Text += "Facebook error: " + ex.Message.ToString(); 
                    Log.Warn(hTAG, ex.Message); 
                } finally { //*/ 
                    conn.Close(); 
                    //conn.Dispose(); 
                    //conn = null; 
                //} 

            } 

I am getting the error 'System.NotSupportedException:' (without try catch). And with try catch the error is: 'CodePage 1252 not supported' I have also tried checking other encoding options in project properties. anyone knows what dll file I have to add or what can be the problem....

Thanks & Regards Hem Singh


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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