Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. TCP/IP connexion failed in csharp smart device

TCP/IP connexion failed in csharp smart device

Scheduled Pinned Locked Moved C#
csharpdatabasehelpquestionhtml
33 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Tunisien86

    Hi Eddy, Thanks a lot for u collaboration :).I understand u meaning.I make changement but still not working. My new code is like that:

    using System;
    using System.Linq;
    using System.Data.SqlServerCe;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Data.SqlClient;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace ModeDifféré
    {
    public partial class Form6 : Form
    {
    public Form6()
    {
    InitializeComponent();
    }

        private void comboBox1\_SelectedIndexChanged(object sender, EventArgs e)
        {
    
        }
    
        private void Form6\_Load(object sender, EventArgs e)
        {
            string sConnection = "Data Source=192.168.1.4,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";
            string sSQL = "SELECT DISTINCT \* FROM D°\_urgence";
            SqlCommand comm = new SqlCommand(sSQL, new SqlConnection(sConnection));
            SqlDataReader dr = null;
            try
            {
                comm.Connection.Open();
                dr = comm.ExecuteReader();
                while (dr.Read())
                    comboBox1.Items.Add(dr\[0\]);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            dr.Close();
            comm.Connection.Close();
        }
    }
    

    }

    In fact,my combobox should contain the result of my select statement,but when running,the system is show an sqlexception and nothing is added to my combobox. Is the IPadress the problem?the ipconfig command returns to me this:

    C:\Users\Admin>ipconfig /all

    Windows IP Configuration

    Host Name . . . . . . . . . . . . : Admin-PC
    Primary Dns Suffix . . . . . . . :
    Node Type . . . . . . . . . . . . : Hybrid
    IP Routing Enabled. . . . . . . . : No
    WINS Proxy Enabled. . . . . . . . : No

    Wireless LAN adapter Wireless Network Connection 2:

    Media State . . . . . . . . . . . : Media disconnected
    Connection-specific DNS Suffix . :
    Description . . . . . . . . . . . : Microsoft Virtual WiFi Miniport Adapter
    Physical Address. . . . . . . . . : 06-1B-9E-4A-A0-8C
    DHCP Enabled. . . . . . . . . . . : Yes
    Autoconfiguration Enabled . . . . : Yes

    Wireless LAN adapter Wireless Network Connection:

    Connection-specific DNS Suffix . :
    Description . . . . . . . . . . . : Atheros AR5007EG Wireless Network Adapter

    T Offline
    T Offline
    Tunisien86
    wrote on last edited by
    #6

    Hi Calla, Eddy suggests that i change sqlcecommand to sqlcommand because I use .mdf database. Or i don't know maybe i am not understanding what he said :laugh: Thanks

    1 Reply Last reply
    0
    • T Tunisien86

      Hi, I develop a GMAO csharp smart device application.I try now to connect to my remote database.mdf using TCP/IP protocol.I created a combobox where i want to extract informations from my table using this select statement:

      "SELECT DISTINCT NObt FROM 4BT ";

      .For my IPadreess of my computer,I use the ipconfig/all command and I take the

      IPv4 Address. . . . . . . . . . . : 192.168.1.4(Preferred)

      My hole code is like this:

      using System;
      using System.Linq;
      using System.Data.SqlServerCe;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Data.SqlClient;
      using System.Drawing;
      using System.Text;
      using System.Windows.Forms;

      namespace ModeDifféré
      {
      public partial class Form6 : Form
      {
      public Form6()
      {
      InitializeComponent();
      }

          private void comboBox1\_SelectedIndexChanged(object sender, EventArgs e)
          {
      
          }
      
          private void Form6\_Load(object sender, EventArgs e)
          {
              string sConnection = "Data Source=192.168.1.4,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";
              string sSQL = "SELECT DISTINCT NObt FROM 4BT";
              SqlCeCommand comm = new SqlCeCommand(sSQL, new SqlCeConnection(sConnection));
              SqlCeDataReader dr = null;
              try
              {
                  comm.Connection.Open();
                  dr = comm.ExecuteReader();
                  while (dr.Read())
                      comboBox1.Items.Add(dr\[0\]);
              }
              catch (Exception ex)
              {
                  MessageBox.Show(ex.Message);
                  return;
              }
              dr.Close();
              comm.Connection.Close();
          }
      }
      

      }

      When running,this error appears:

      Unknown connection option in connection string: initial catalog.

      As an information,I follow the steps of this link:http://netcf2.blogspot.com/2005/12/accessing-sql-server-express-from.html[^] What is the problem??? Thank u for all u suggestion Regards Marwen :)

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #7

      don't use

      catch (Exception ex) {
          MessageBox.Show(ex.Message);
      }
      

      as it may hide a lot of useful information. Instead use

      catch (Exception ex) {
          MessageBox.Show(ex.ToString());
      }
      

      at least as long as it is not working properly all the time. :)

      Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


      Prolific encyclopedia fixture proof-reader browser patron addict?
      We all depend on the beast below.


      T 1 Reply Last reply
      0
      • L Luc Pattyn

        don't use

        catch (Exception ex) {
            MessageBox.Show(ex.Message);
        }
        

        as it may hide a lot of useful information. Instead use

        catch (Exception ex) {
            MessageBox.Show(ex.ToString());
        }
        

        at least as long as it is not working properly all the time. :)

        Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


        Prolific encyclopedia fixture proof-reader browser patron addict?
        We all depend on the beast below.


        T Offline
        T Offline
        Tunisien86
        wrote on last edited by
        #8

        Hi Luc, I made the changement u ask but the exception still.I wanna clarify that I wanna connect to my database .mdf and not .sdf.Something still not clear in my mind why should i use .mdf database or I work a mobile application so .sdf database required??,:mad: Thanks for u contribution :((

        L 1 Reply Last reply
        0
        • T Tunisien86

          Hi Luc, I made the changement u ask but the exception still.I wanna clarify that I wanna connect to my database .mdf and not .sdf.Something still not clear in my mind why should i use .mdf database or I work a mobile application so .sdf database required??,:mad: Thanks for u contribution :((

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #9

          Tunisien86 wrote:

          but the exception still

          what did you expect? it does not make the exception go away, it makes you get more information from it, so you have a better chance at understanding what goes wrong and where. X|

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


          Prolific encyclopedia fixture proof-reader browser patron addict?
          We all depend on the beast below.


          1 Reply Last reply
          0
          • T Tunisien86

            Hi, I develop a GMAO csharp smart device application.I try now to connect to my remote database.mdf using TCP/IP protocol.I created a combobox where i want to extract informations from my table using this select statement:

            "SELECT DISTINCT NObt FROM 4BT ";

            .For my IPadreess of my computer,I use the ipconfig/all command and I take the

            IPv4 Address. . . . . . . . . . . : 192.168.1.4(Preferred)

            My hole code is like this:

            using System;
            using System.Linq;
            using System.Data.SqlServerCe;
            using System.Collections.Generic;
            using System.ComponentModel;
            using System.Data;
            using System.Data.SqlClient;
            using System.Drawing;
            using System.Text;
            using System.Windows.Forms;

            namespace ModeDifféré
            {
            public partial class Form6 : Form
            {
            public Form6()
            {
            InitializeComponent();
            }

                private void comboBox1\_SelectedIndexChanged(object sender, EventArgs e)
                {
            
                }
            
                private void Form6\_Load(object sender, EventArgs e)
                {
                    string sConnection = "Data Source=192.168.1.4,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";
                    string sSQL = "SELECT DISTINCT NObt FROM 4BT";
                    SqlCeCommand comm = new SqlCeCommand(sSQL, new SqlCeConnection(sConnection));
                    SqlCeDataReader dr = null;
                    try
                    {
                        comm.Connection.Open();
                        dr = comm.ExecuteReader();
                        while (dr.Read())
                            comboBox1.Items.Add(dr\[0\]);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                        return;
                    }
                    dr.Close();
                    comm.Connection.Close();
                }
            }
            

            }

            When running,this error appears:

            Unknown connection option in connection string: initial catalog.

            As an information,I follow the steps of this link:http://netcf2.blogspot.com/2005/12/accessing-sql-server-express-from.html[^] What is the problem??? Thank u for all u suggestion Regards Marwen :)

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #10

            Is the remote instance really 192.168.1.4 or is it 192.168.1.4\SQLExpress? By default SQLExpress databases run under a SQLExpress instance, and this is what you need to connect to.

            "WPF has many lovers. It's a veritable porn star!" - Josh Smith

            As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

            My blog | My articles | MoXAML PowerToys | Onyx

            M T 2 Replies Last reply
            0
            • T Tunisien86

              Hi Eddy, Thanks a lot for u collaboration :).I understand u meaning.I make changement but still not working. My new code is like that:

              using System;
              using System.Linq;
              using System.Data.SqlServerCe;
              using System.Collections.Generic;
              using System.ComponentModel;
              using System.Data;
              using System.Data.SqlClient;
              using System.Drawing;
              using System.Text;
              using System.Windows.Forms;

              namespace ModeDifféré
              {
              public partial class Form6 : Form
              {
              public Form6()
              {
              InitializeComponent();
              }

                  private void comboBox1\_SelectedIndexChanged(object sender, EventArgs e)
                  {
              
                  }
              
                  private void Form6\_Load(object sender, EventArgs e)
                  {
                      string sConnection = "Data Source=192.168.1.4,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";
                      string sSQL = "SELECT DISTINCT \* FROM D°\_urgence";
                      SqlCommand comm = new SqlCommand(sSQL, new SqlConnection(sConnection));
                      SqlDataReader dr = null;
                      try
                      {
                          comm.Connection.Open();
                          dr = comm.ExecuteReader();
                          while (dr.Read())
                              comboBox1.Items.Add(dr\[0\]);
                      }
                      catch (Exception ex)
                      {
                          MessageBox.Show(ex.Message);
                          return;
                      }
                      dr.Close();
                      comm.Connection.Close();
                  }
              }
              

              }

              In fact,my combobox should contain the result of my select statement,but when running,the system is show an sqlexception and nothing is added to my combobox. Is the IPadress the problem?the ipconfig command returns to me this:

              C:\Users\Admin>ipconfig /all

              Windows IP Configuration

              Host Name . . . . . . . . . . . . : Admin-PC
              Primary Dns Suffix . . . . . . . :
              Node Type . . . . . . . . . . . . : Hybrid
              IP Routing Enabled. . . . . . . . : No
              WINS Proxy Enabled. . . . . . . . : No

              Wireless LAN adapter Wireless Network Connection 2:

              Media State . . . . . . . . . . . : Media disconnected
              Connection-specific DNS Suffix . :
              Description . . . . . . . . . . . : Microsoft Virtual WiFi Miniport Adapter
              Physical Address. . . . . . . . . : 06-1B-9E-4A-A0-8C
              DHCP Enabled. . . . . . . . . . . : Yes
              Autoconfiguration Enabled . . . . : Yes

              Wireless LAN adapter Wireless Network Connection:

              Connection-specific DNS Suffix . :
              Description . . . . . . . . . . . : Atheros AR5007EG Wireless Network Adapter

              M Offline
              M Offline
              Michel Godfroid
              wrote on last edited by
              #11

              You'll have to check 1) Do you have network connectivity on your emulator: start Internet explorer on the emulator, and try to access a well known website (www.codeproject.com). 2) Is your firewall open on port 1433? Also, which exception are you getting now? we need the full text of the exception, which you should now have, if you followed Luc Pattyns' code.

              T 1 Reply Last reply
              0
              • P Pete OHanlon

                Is the remote instance really 192.168.1.4 or is it 192.168.1.4\SQLExpress? By default SQLExpress databases run under a SQLExpress instance, and this is what you need to connect to.

                "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                My blog | My articles | MoXAML PowerToys | Onyx

                T Offline
                T Offline
                Tunisien86
                wrote on last edited by
                #12

                Hello, I have an sql server 2005 standart Edition and not express.A snapshot of my sqlexception is available at this link http://yfrog.com/iycaptureawj[^] Thanks

                M 1 Reply Last reply
                0
                • P Pete OHanlon

                  Is the remote instance really 192.168.1.4 or is it 192.168.1.4\SQLExpress? By default SQLExpress databases run under a SQLExpress instance, and this is what you need to connect to.

                  "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                  As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                  My blog | My articles | MoXAML PowerToys | Onyx

                  M Offline
                  M Offline
                  Michel Godfroid
                  wrote on last edited by
                  #13

                  If I follow the code in the article he refers to, he would have dumped the instance browser, and locked SqlExpress to port 1433.

                  1 Reply Last reply
                  0
                  • T Tunisien86

                    Hello, I have an sql server 2005 standart Edition and not express.A snapshot of my sqlexception is available at this link http://yfrog.com/iycaptureawj[^] Thanks

                    M Offline
                    M Offline
                    Michel Godfroid
                    wrote on last edited by
                    #14

                    Ah the joy of developing for mobile! X| We can't read the full exception (your screen is too small). Put a breakpoint at the exception statement, and examine the 'ex' variable when the expression occurs.

                    T 1 Reply Last reply
                    0
                    • M Michel Godfroid

                      You'll have to check 1) Do you have network connectivity on your emulator: start Internet explorer on the emulator, and try to access a well known website (www.codeproject.com). 2) Is your firewall open on port 1433? Also, which exception are you getting now? we need the full text of the exception, which you should now have, if you followed Luc Pattyns' code.

                      T Offline
                      T Offline
                      Tunisien86
                      wrote on last edited by
                      #15

                      Hi Micheal, As a reponse of u suggestions: 1)my emulator doesn't have network connectivity. 2)how can i know that my firewall is open on port 1433? 3)the sqlexception I got :http://yfrog.com/iycaptureawj[^] Thanks :)

                      M 1 Reply Last reply
                      0
                      • T Tunisien86

                        Hi Eddy, Thanks a lot for u collaboration :).I understand u meaning.I make changement but still not working. My new code is like that:

                        using System;
                        using System.Linq;
                        using System.Data.SqlServerCe;
                        using System.Collections.Generic;
                        using System.ComponentModel;
                        using System.Data;
                        using System.Data.SqlClient;
                        using System.Drawing;
                        using System.Text;
                        using System.Windows.Forms;

                        namespace ModeDifféré
                        {
                        public partial class Form6 : Form
                        {
                        public Form6()
                        {
                        InitializeComponent();
                        }

                            private void comboBox1\_SelectedIndexChanged(object sender, EventArgs e)
                            {
                        
                            }
                        
                            private void Form6\_Load(object sender, EventArgs e)
                            {
                                string sConnection = "Data Source=192.168.1.4,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";
                                string sSQL = "SELECT DISTINCT \* FROM D°\_urgence";
                                SqlCommand comm = new SqlCommand(sSQL, new SqlConnection(sConnection));
                                SqlDataReader dr = null;
                                try
                                {
                                    comm.Connection.Open();
                                    dr = comm.ExecuteReader();
                                    while (dr.Read())
                                        comboBox1.Items.Add(dr\[0\]);
                                }
                                catch (Exception ex)
                                {
                                    MessageBox.Show(ex.Message);
                                    return;
                                }
                                dr.Close();
                                comm.Connection.Close();
                            }
                        }
                        

                        }

                        In fact,my combobox should contain the result of my select statement,but when running,the system is show an sqlexception and nothing is added to my combobox. Is the IPadress the problem?the ipconfig command returns to me this:

                        C:\Users\Admin>ipconfig /all

                        Windows IP Configuration

                        Host Name . . . . . . . . . . . . : Admin-PC
                        Primary Dns Suffix . . . . . . . :
                        Node Type . . . . . . . . . . . . : Hybrid
                        IP Routing Enabled. . . . . . . . : No
                        WINS Proxy Enabled. . . . . . . . : No

                        Wireless LAN adapter Wireless Network Connection 2:

                        Media State . . . . . . . . . . . : Media disconnected
                        Connection-specific DNS Suffix . :
                        Description . . . . . . . . . . . : Microsoft Virtual WiFi Miniport Adapter
                        Physical Address. . . . . . . . . : 06-1B-9E-4A-A0-8C
                        DHCP Enabled. . . . . . . . . . . : Yes
                        Autoconfiguration Enabled . . . . : Yes

                        Wireless LAN adapter Wireless Network Connection:

                        Connection-specific DNS Suffix . :
                        Description . . . . . . . . . . . : Atheros AR5007EG Wireless Network Adapter

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #16

                        Tunisien86 wrote:

                        In fact,my combobox should contain the result of my select statement,but when running,the system is show an sqlexception and nothing is added to my combobox.

                        It's easier to find a problem if you include the message of the exception. In this case it's probably caused by a common error - your tablenames contain illegal characters. You can "fix" it with brackets;

                        string sSQL = "SELECT DISTINCT * FROM [D°_urgence]";

                        Also note that the change in code assumes that your select-statement is run against an SQL Server instance, one that has access to the *.mdf-file that you want to read from. If this data is stored locally, in an *.sdf file, then you'd indeed need the SqlCe-classes.

                        Tunisien86 wrote:

                        Or should I take the physical @ as the @ of my computer?

                        Ideally, you take the computers' name and the instance name and put it in a configurationfile. Something like "Admin-PC/MySql2005Instance". There might be lots of IP-adresses on a computer, but it usually only has a single name that identifies it in the network. It also communicates easier, imagine yelling "Reboot Skynet and Idefix" in contract to "Reboot One-Nine-Two Doht One-Six-Eight Doht One Doht Zero.. - No Four, I meant Four!" :cool:

                        I are Troll :suss:

                        T 2 Replies Last reply
                        0
                        • T Tunisien86

                          Hi, I develop a GMAO csharp smart device application.I try now to connect to my remote database.mdf using TCP/IP protocol.I created a combobox where i want to extract informations from my table using this select statement:

                          "SELECT DISTINCT NObt FROM 4BT ";

                          .For my IPadreess of my computer,I use the ipconfig/all command and I take the

                          IPv4 Address. . . . . . . . . . . : 192.168.1.4(Preferred)

                          My hole code is like this:

                          using System;
                          using System.Linq;
                          using System.Data.SqlServerCe;
                          using System.Collections.Generic;
                          using System.ComponentModel;
                          using System.Data;
                          using System.Data.SqlClient;
                          using System.Drawing;
                          using System.Text;
                          using System.Windows.Forms;

                          namespace ModeDifféré
                          {
                          public partial class Form6 : Form
                          {
                          public Form6()
                          {
                          InitializeComponent();
                          }

                              private void comboBox1\_SelectedIndexChanged(object sender, EventArgs e)
                              {
                          
                              }
                          
                              private void Form6\_Load(object sender, EventArgs e)
                              {
                                  string sConnection = "Data Source=192.168.1.4,1433;Initial Catalog=GMAO;User ID=sa;Password=sa;";
                                  string sSQL = "SELECT DISTINCT NObt FROM 4BT";
                                  SqlCeCommand comm = new SqlCeCommand(sSQL, new SqlCeConnection(sConnection));
                                  SqlCeDataReader dr = null;
                                  try
                                  {
                                      comm.Connection.Open();
                                      dr = comm.ExecuteReader();
                                      while (dr.Read())
                                          comboBox1.Items.Add(dr\[0\]);
                                  }
                                  catch (Exception ex)
                                  {
                                      MessageBox.Show(ex.Message);
                                      return;
                                  }
                                  dr.Close();
                                  comm.Connection.Close();
                              }
                          }
                          

                          }

                          When running,this error appears:

                          Unknown connection option in connection string: initial catalog.

                          As an information,I follow the steps of this link:http://netcf2.blogspot.com/2005/12/accessing-sql-server-express-from.html[^] What is the problem??? Thank u for all u suggestion Regards Marwen :)

                          P Offline
                          P Offline
                          Pete OHanlon
                          wrote on last edited by
                          #17

                          Try changing your connection string to

                          Data Source=192.168.1.4,1433;Network Library=DBMSSOCN;Initial Catalog=GMAO;User ID=sa;Password=sa

                          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                          My blog | My articles | MoXAML PowerToys | Onyx

                          T 1 Reply Last reply
                          0
                          • T Tunisien86

                            Hi Micheal, As a reponse of u suggestions: 1)my emulator doesn't have network connectivity. 2)how can i know that my firewall is open on port 1433? 3)the sqlexception I got :http://yfrog.com/iycaptureawj[^] Thanks :)

                            M Offline
                            M Offline
                            Michel Godfroid
                            wrote on last edited by
                            #18

                            Tunisien86 wrote:

                            the sqlexception I got :http://yfrog.com/iycaptureawj\[^\]

                            Yeah, that one we've already seen. try to get the full exception ON THE PC (see my other reply about this)

                            Tunisien86 wrote:

                            my emulator doesn't have network connectivity.

                            Well, there you have it. No point in testing the others until you can establish that. 1) Is your emulator cradled? 2) do you see the connection in Mobile device center or in ActiveSync?

                            T 1 Reply Last reply
                            0
                            • L Lost User

                              Tunisien86 wrote:

                              In fact,my combobox should contain the result of my select statement,but when running,the system is show an sqlexception and nothing is added to my combobox.

                              It's easier to find a problem if you include the message of the exception. In this case it's probably caused by a common error - your tablenames contain illegal characters. You can "fix" it with brackets;

                              string sSQL = "SELECT DISTINCT * FROM [D°_urgence]";

                              Also note that the change in code assumes that your select-statement is run against an SQL Server instance, one that has access to the *.mdf-file that you want to read from. If this data is stored locally, in an *.sdf file, then you'd indeed need the SqlCe-classes.

                              Tunisien86 wrote:

                              Or should I take the physical @ as the @ of my computer?

                              Ideally, you take the computers' name and the instance name and put it in a configurationfile. Something like "Admin-PC/MySql2005Instance". There might be lots of IP-adresses on a computer, but it usually only has a single name that identifies it in the network. It also communicates easier, imagine yelling "Reboot Skynet and Idefix" in contract to "Reboot One-Nine-Two Doht One-Six-Eight Doht One Doht Zero.. - No Four, I meant Four!" :cool:

                              I are Troll :suss:

                              T Offline
                              T Offline
                              Tunisien86
                              wrote on last edited by
                              #19

                              Hi Eddy, I wanna clarify something.The database I would connect to is the database of the society I work in.As u know,maintenance societies try try to make easy its work:a technician uses the PDA to connect to the database of the society and finishs his work.The "big" database is a .mdf file.Something was not clear how can i connect to .mdf databse while i should connect to .sdf fine because I develop a mobile application??Is that possible Also about the ip@,is it true what i did?I don't understand u statement really :) is it a problem of Firewall???? Thanks

                              1 Reply Last reply
                              0
                              • P Pete OHanlon

                                Try changing your connection string to

                                Data Source=192.168.1.4,1433;Network Library=DBMSSOCN;Initial Catalog=GMAO;User ID=sa;Password=sa

                                "WPF has many lovers. It's a veritable porn star!" - Josh Smith

                                As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

                                My blog | My articles | MoXAML PowerToys | Onyx

                                T Offline
                                T Offline
                                Tunisien86
                                wrote on last edited by
                                #20

                                Hi Pete, I changed but the sqlexception still:

                                Unknown connection option in connection string: network library.

                                thanks

                                1 Reply Last reply
                                0
                                • M Michel Godfroid

                                  Ah the joy of developing for mobile! X| We can't read the full exception (your screen is too small). Put a breakpoint at the exception statement, and examine the 'ex' variable when the expression occurs.

                                  T Offline
                                  T Offline
                                  Tunisien86
                                  wrote on last edited by
                                  #21

                                  Hi Michel, when running the exception is :

                                  NULLREFERENCEEXCEPTION IS UNHANDLED
                                  Null ReferenceException

                                  and it point to this statement of my code:

                                  dr.Close();

                                  Thanks

                                  M 1 Reply Last reply
                                  0
                                  • T Tunisien86

                                    Hi Michel, when running the exception is :

                                    NULLREFERENCEEXCEPTION IS UNHANDLED
                                    Null ReferenceException

                                    and it point to this statement of my code:

                                    dr.Close();

                                    Thanks

                                    M Offline
                                    M Offline
                                    Michel Godfroid
                                    wrote on last edited by
                                    #22

                                    No, that's another exception. It happens because your try block never executed succesfully. put a breakpoint at MessageBox.Show(ex.Message); and look at the value of ex then (with the debugger)

                                    T 1 Reply Last reply
                                    0
                                    • M Michel Godfroid

                                      Tunisien86 wrote:

                                      the sqlexception I got :http://yfrog.com/iycaptureawj\[^\]

                                      Yeah, that one we've already seen. try to get the full exception ON THE PC (see my other reply about this)

                                      Tunisien86 wrote:

                                      my emulator doesn't have network connectivity.

                                      Well, there you have it. No point in testing the others until you can establish that. 1) Is your emulator cradled? 2) do you see the connection in Mobile device center or in ActiveSync?

                                      T Offline
                                      T Offline
                                      Tunisien86
                                      wrote on last edited by
                                      #23

                                      Hi Michel, My emulator is not cradling.When googling,I found this link talking about how to cradle an emulator:http://netcf2.blogspot.com/2005/11/getting-started-using-emulator.html[^] I wanna ask should I use a real PDA?is the emulator enough? Thanks

                                      M 1 Reply Last reply
                                      0
                                      • M Michel Godfroid

                                        No, that's another exception. It happens because your try block never executed succesfully. put a breakpoint at MessageBox.Show(ex.Message); and look at the value of ex then (with the debugger)

                                        T Offline
                                        T Offline
                                        Tunisien86
                                        wrote on last edited by
                                        #24

                                        Hi Michel, The same appears as i wrote last time,same exception expression thanks

                                        1 Reply Last reply
                                        0
                                        • T Tunisien86

                                          Hi Michel, My emulator is not cradling.When googling,I found this link talking about how to cradle an emulator:http://netcf2.blogspot.com/2005/11/getting-started-using-emulator.html[^] I wanna ask should I use a real PDA?is the emulator enough? Thanks

                                          M Offline
                                          M Offline
                                          Michel Godfroid
                                          wrote on last edited by
                                          #25

                                          You should cradle it. cradling will give the emulator an IP address. In mobile device center, be sure to select 'DMA' in connection settings. Then do the internet explorer test again.

                                          T 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups