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

Is it possible to implement whatsapp icon showing number of unread messages through Xamarin?

$
0
0

I came to know that SqlDependency is not possible in android. But is there a way to detect change in MSSQL table?

This is what I tried through SqlDependency
`

using (System.Data.SqlClient.SqlConnection cn = new System.Data.SqlClient.SqlConnection(
                        new System.Data.SqlClient.SqlConnectionStringBuilder()
                        {
                            DataSource="192.168.0.101,1433\\SqlExpress",
                            InitialCatalog="LTKM_latest",
                            UserID="sa",
                            Password="Welcome123"
                        }.ConnectionString
                        ))
                    {


                    cn.Open();
                    using (System.Data.SqlClient.SqlCommand cm = new System.Data.SqlClient.SqlCommand("select * from Mts_tra_CH", cn))
                    {
                        cm.Notification = null;
                        System.Data.SqlClient.SqlDependency.Start(@"Data Source=192.168.0.101,1433\SQLEXPRESS;Initial Catalog=LTKM_latest;Persist Security Info=True;User ID=sa;Password=Welcome123;");

                        System.Data.SqlClient.SqlDependency sqldep = new System.Data.SqlClient.SqlDependency();// (cm);
                        sqldep.OnChange += (ss, ee) =>
                        {
                            Toast.MakeText(ApplicationContext, "changed", ToastLength.Long).Show();
                        };
                    }
                }`

and got this error
"Input string was not in a correct format"
stack trace
at System.Number.StringToNumber (System.String str, System.Globalization.NumberStyles options, System.Number+NumberBuffer& number, System.Globalization.NumberFormatInfo info, System.Boolean parseDecimal) [0x00054] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/number.cs:1074 at System.Number.ParseInt32 (System.String s, System.Globalization.NumberStyles style, System.Globalization.NumberFormatInfo info) [0x00014] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/number.cs:745 at System.Int32.Parse (System.String s) [0x00000] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/int32.cs:120 at System.Data.SqlClient.SqlConnection.ParseDataSource (System.String theDataSource, System.Int32& thePort, System.String& theServerName) [0x0004d] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs:551 at System.Data.SqlClient.SqlConnection.Open () [0x000c3] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs:496


Viewing all articles
Browse latest Browse all 204402

Trending Articles



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