1

Please help. I have device MC3200 Zebra(motorola)(Windows Embedded version 7, build 2864). This device is connecting to network and see SQL server(ping is OK). I used it Visual Studio 2008, c#, SmartDevicePrj, .NET CF 3.5

enter image description here

But after start application on device will be displayed message:

Unknown connection option in connection string: initial catalog.

Some idea how to repair it?

Many thanks for your help.

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

namespace SmartDeviceProject1
{
    public partial class Form1 : Form
    {
        public SqlCeConnection msConn;
        public string strCon = "";
        public SqlCeCommand command;

        public Form1()
        {
            InitializeComponent();
            strCon = "Data Source=server007; Initial Catalog=FMPredlis; User ID=mistr; Password=heslo;";
            try
            {
                msConn = new SqlCeConnection(strCon);
                msConn.Open();
                MessageBox.Show("Připojeno");
            }
            catch (SqlCeException ex)
            {
                MessageBox.Show("Chyba" + ex.Message);
                msConn.Close();
            }
        }
    }
}
JustBaron
  • 2,319
  • 7
  • 25
  • 37

1 Answers1

0

I think you are mixing 2 things.

Either use The SqlConnection object, then you can connect to a SQL Server using a connection string found on this page: https://www.connectionstrings.com/sql-server/

Or use like in your code the SqlCEConnection, then you connect to a SQL Lite (local file), and your connection string should be like on this page: https://www.connectionstrings.com/sqlite/

But in your sample you are using SqlCEConnection to connect to a sql server, that wont work.

Grtz

Ben Croughs
  • 2,566
  • 1
  • 20
  • 30
  • Yes I actually mixed two things. At the start of the project I had a problem with the System.Data.SqlClient reference, so I went out of the way. Now everything is working. I still had a problem with dbnetlib.dll, but I have solved it by https://stackoverflow.com/questions/21838161/cant-find-pinvoke-dll-dbnetlib-dll-error-in-smart-device-application Many thanks for your help! – Zdeněk Sehnal Sep 19 '17 at 04:27