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. Remote Data Acces RDA not allowed in csharp smart device,????

Remote Data Acces RDA not allowed in csharp smart device,????

Scheduled Pinned Locked Moved C#
csharpdatabasehelpsql-serverlinq
6 Posts 2 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 Offline
    T Offline
    Tunisien86
    wrote on last edited by
    #1

    Hi, I try to develop a csharp smart device application.I want to try the RDA method to connect to the database .mdf located in my collegue'sPC My 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=Bacem-PC;User ID=sa;Password=sa;Initial Catalog=GMAO;Persist Security Info=false;";
            string sSQL = "SELECT Nbt FROM 4BT; ";
            SqlConnection conn = new SqlConnection(sConnection);
            SqlCommand comm = new SqlCommand(sSQL, conn);
            SqlDataReader dr = null;
            try
            {
                
                comm.Connection.Open();
                dr = comm.ExecuteReader();
                while (dr.Read())
                    comboBox1.Items.Add(dr\[0\]);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("connexion impossible");
                MessageBox.Show(ex.Message);
                return;
            }
    
            dr.Close();
            comm.Connection.Close();
        }
    }
    

    }

    where bacem-PC is my freind'sPC server .He enables remote connexion to his sql server. When running,this error appears:"specified sql server not found or acces denied" As a note,this is the same arror that appears when I try locally in my PC I am really fed up of this annoying error?? URGENT HELP I NEED or i will be a mad person :-O Thanks

    S 1 Reply Last reply
    0
    • T Tunisien86

      Hi, I try to develop a csharp smart device application.I want to try the RDA method to connect to the database .mdf located in my collegue'sPC My 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=Bacem-PC;User ID=sa;Password=sa;Initial Catalog=GMAO;Persist Security Info=false;";
              string sSQL = "SELECT Nbt FROM 4BT; ";
              SqlConnection conn = new SqlConnection(sConnection);
              SqlCommand comm = new SqlCommand(sSQL, conn);
              SqlDataReader dr = null;
              try
              {
                  
                  comm.Connection.Open();
                  dr = comm.ExecuteReader();
                  while (dr.Read())
                      comboBox1.Items.Add(dr\[0\]);
              }
              catch (SqlException ex)
              {
                  MessageBox.Show("connexion impossible");
                  MessageBox.Show(ex.Message);
                  return;
              }
      
              dr.Close();
              comm.Connection.Close();
          }
      }
      

      }

      where bacem-PC is my freind'sPC server .He enables remote connexion to his sql server. When running,this error appears:"specified sql server not found or acces denied" As a note,this is the same arror that appears when I try locally in my PC I am really fed up of this annoying error?? URGENT HELP I NEED or i will be a mad person :-O Thanks

      S Offline
      S Offline
      Stanciu Vlad
      wrote on last edited by
      #2

      Funny thing... :) Afther a whole thread in which I tried to solve your problem but did not succed you are not demoralised and still prospecting for new solutions... I like your persistence :-D You previously said that Visual Studio and Management Studio can connect to your database. If so: add a dataset to your project, and from Visual Studio's datasources (usualy in the left of the screen) drag your tables onto the dataset. This will generate code that connects to your database retrives rows and can update them. (If you don't know how to use this google for Dataset and Strongly Typed Dataset).

      I have no smart signature yet...

      T 2 Replies Last reply
      0
      • S Stanciu Vlad

        Funny thing... :) Afther a whole thread in which I tried to solve your problem but did not succed you are not demoralised and still prospecting for new solutions... I like your persistence :-D You previously said that Visual Studio and Management Studio can connect to your database. If so: add a dataset to your project, and from Visual Studio's datasources (usualy in the left of the screen) drag your tables onto the dataset. This will generate code that connects to your database retrives rows and can update them. (If you don't know how to use this google for Dataset and Strongly Typed Dataset).

        I have no smart signature yet...

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

        Hi Vlad, :laugh: When I have a problem,I don't be happy only if I solve it with all kinds of problems The problem,Vlad,is that the database I want to connect to is is .mdf database and not .sdf file(used in mobile applications).I want to clarify to u that my project has an object to help the technician communicates successfully with his society'sdatabase.In fact,This society has a .mdf databse created with sql server.The technician will communicate with it with his PDA or his mobile.So that is why I try to connect to my freind'sPC server simulating the process I described above. If i will add a dataset like u said,I really don't understand to drag tables of .mdf database and use them like .sdf one because in visual studio smart device application doesn't accept only .sdf database files. I seem sometimes very curious :laugh: but really I want to demonstrate to all that Marwen can deal well very diffucult problems :laugh: Thanks for u collaboration. ;)

        S 1 Reply Last reply
        0
        • T Tunisien86

          Hi Vlad, :laugh: When I have a problem,I don't be happy only if I solve it with all kinds of problems The problem,Vlad,is that the database I want to connect to is is .mdf database and not .sdf file(used in mobile applications).I want to clarify to u that my project has an object to help the technician communicates successfully with his society'sdatabase.In fact,This society has a .mdf databse created with sql server.The technician will communicate with it with his PDA or his mobile.So that is why I try to connect to my freind'sPC server simulating the process I described above. If i will add a dataset like u said,I really don't understand to drag tables of .mdf database and use them like .sdf one because in visual studio smart device application doesn't accept only .sdf database files. I seem sometimes very curious :laugh: but really I want to demonstrate to all that Marwen can deal well very diffucult problems :laugh: Thanks for u collaboration. ;)

          S Offline
          S Offline
          Stanciu Vlad
          wrote on last edited by
          #4

          So you are saying that this is a smart device application? If so, then probably your smart device simulator is not in the same network (if any) with you database server. You might want to check this link[^].

          I have no smart signature yet...

          T 1 Reply Last reply
          0
          • S Stanciu Vlad

            So you are saying that this is a smart device application? If so, then probably your smart device simulator is not in the same network (if any) with you database server. You might want to check this link[^].

            I have no smart signature yet...

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

            Hi, Thanks I check the link but almost for the steps I did.But nothing is new :(( I need really urgent help :( Thanks

            1 Reply Last reply
            0
            • S Stanciu Vlad

              Funny thing... :) Afther a whole thread in which I tried to solve your problem but did not succed you are not demoralised and still prospecting for new solutions... I like your persistence :-D You previously said that Visual Studio and Management Studio can connect to your database. If so: add a dataset to your project, and from Visual Studio's datasources (usualy in the left of the screen) drag your tables onto the dataset. This will generate code that connects to your database retrives rows and can update them. (If you don't know how to use this google for Dataset and Strongly Typed Dataset).

              I have no smart signature yet...

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

              Hi Vlad, Finally I depass the problem of the connexion to server by the DB File's attachment :laugh: . No exception apperas.Still now the problem of the filling of my combobox .I try with sqldataset instead of the sqlreader like this:

              string sConnection = "Data Source=127.0.0.1,1433;Persist Security Info=True;Initial Catalog=GMAO;User ID=sa;Password=sa";
              string sSQL = "SELECT com FROM energie; ";
              SqlConnection conn = new SqlConnection(sConnection);
              SqlCommand comm = new SqlCommand(sSQL, conn);
              DataSet ds = new DataSet();
              SqlCeDataAdapter da = new SqlCeDataAdapter();
              SqlDataReader dr = null;
              try
              {

              comm.Connection.Open();
              da.Fill(ds, "SQL Temp Table");
              foreach(DataRow d in ds.Tables\[0\].Rows)
              comboBox1.Items.Add(d.ToString());
              

              }
              catch (SqlException ex)
              {
              //MessageBox.Show("connexion impossible");
              MessageBox.Show(ex.Message);
              return;
              }

              dr.Close();
              comm.Connection.Close();
              }

              but nothing is added to my combobox. Thanks in all cases for u collaboration :laugh: I am really so happy

              1 Reply 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