Re: Trouble connecting to SQL Server 2000 from Windows Mobile device
- From: "David C via SQLMonster.com" <u12346@uwe>
- Date: Wed, 16 Nov 2005 19:32:29 GMT
Never mind...I got it to work. I had to create a new user on the SQLServer
with standard authorization (non-trusted).
David
David C wrote:
>I am having trouble connecting to a SQL Server 2000 server on our network.
>The device is connected wirelessly to the network. I can ping the IP address
>of our SQL Server from the mobile device. I can get on the internet using the
>device. But I get an SQLException when trying to run just a very simple app
>that is suppose to connect to the SQL Server Northwind database. Here is my
>simple app. The app is suppose to just pull one record and show the record
>count in a text box on a form but never gets to that point. It bombs on the
>connection. Could someone tell me if my connection string is off or something?
>
>Thanks,
>David
>
>using System;
>using System.Drawing;
>using System.Collections;
>using System.Windows.Forms;
>using System.Data;
>using System.Data.Common;
>using System.Data.SqlClient;
>
>namespace TestSQL
>{
> /// <summary>
> /// Summary description for Form1.
> /// </summary>
> public class Form1 : System.Windows.Forms.Form
> {
> private System.Windows.Forms.TextBox textBox1;
> private System.Windows.Forms.TextBox textBox2;
> private System.Windows.Forms.MainMenu mainMenu1;
>
> public Form1()
> {
> //
> // Required for Windows Form Designer support
> //
> InitializeComponent();
>
> //
> // TODO: Add any constructor code after InitializeComponent call
> //
> }
> /// <summary>
> /// Clean up any resources being used.
> /// </summary>
> protected override void Dispose( bool disposing )
> {
> base.Dispose( disposing );
> }
> #region Windows Form Designer generated code
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> this.mainMenu1 = new System.Windows.Forms.MainMenu();
> this.textBox1 = new System.Windows.Forms.TextBox();
> this.textBox2 = new System.Windows.Forms.TextBox();
> //
> // textBox1
> //
> this.textBox1.Location = new System.Drawing.Point(32, 40);
> this.textBox1.Size = new System.Drawing.Size(184, 22);
> this.textBox1.Text = "textBox1";
> //
> // textBox2
> //
> this.textBox2.Location = new System.Drawing.Point(32, 88);
> this.textBox2.Size = new System.Drawing.Size(184, 22);
> this.textBox2.Text = "textBox2";
> //
> // Form1
> //
> this.Controls.Add(this.textBox2);
> this.Controls.Add(this.textBox1);
> this.Menu = this.mainMenu1;
> this.Text = "Form1";
> this.Load += new System.EventHandler(this.Form1_Load);
>
> }
> #endregion
>
> /// <summary>
> /// The main entry point for the application.
> /// </summary>
>
> static void Main()
> {
> Application.Run(new Form1());
> }
>
> private void Form1_Load(object sender, System.EventArgs e)
> {
> // Connection String for MSSQL Server 200
> // Server IP 192.168.251.32, dummy database = WINSTSDB, dummy user =
>sleeptrain
> string Connection_String = "Data Source=192.168.251.32;Initial
>Catalog=Northwind;User Id=sleeptrain;Password=monkeytrain";
> // Setup SQL Connection object
> SqlConnection dbConn = new SqlConnection( Connection_String );
>
> // This routine will create a detailed table structure report
> SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM dbo.Employees WHERE
>EmployeeID = 1",dbConn);
>
> // Define a Data Table object
> System.Data.DataTable WinstisTable = new DataTable();
>
>
> dbConn.Open();
> da.Fill( WinstisTable );
>
> this.textBox1.Text = "Count = " + WinstisTable.Rows.Count.ToString();
>
> dbConn.Close();
> da.Dispose();
>
> }
> }
>}
--
Message posted via SQLMonster.com
http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-ce/200511/1
.
- References:
- Trouble connecting to SQL Server 2000 from Windows Mobile device
- From: David C via SQLMonster.com
- Trouble connecting to SQL Server 2000 from Windows Mobile device
- Prev by Date: Re: Pocket PC Deployment Issue in Windows Mobile 5.0
- Next by Date: RE: SQL Mobile replication error...???
- Previous by thread: Trouble connecting to SQL Server 2000 from Windows Mobile device
- Next by thread: Inserting null value in nvarchar column
- Index(es):
Relevant Pages
|