RE: Trouble connecting to SQL Server 2000 from Mobile Device



Hi Tony,
I actually did try putting it in a try..catch block and the
Exception.Message
value returned was simply "SqlException". No numeric error code or anything.
I was surprised it did not give more details.

I will check the authentication and database permissions.

David


"chmilne" wrote:

> All of your code seems to be in order.
>
> What specific error are you getting? Wrap the connection code in a try
> catch block catching a SQLException.
>
> If it is a 'Login failed for user...' error, then chances are your SQL
> server user/security is setup wrong. Be sure your SQL server's
> authentication is set to 'SQL Server' and your user id 'sleeptrain' has been
> granted permission to access the NW db.
>
> TONY
>
>
> "dcuffee" wrote:
>
> > I am having trouble connecting to a SQL Server 2000 server on our network.
> > The handheld 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. It doesnt
> > give any error code. 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();
> >
> > }
> > }
> > }
.



Relevant Pages

  • RE: Trouble connecting to SQL Server 2000 from Mobile Device
    ... That's because you need to catch a SQLException, ... No numeric error code or anything. ... Here is my simple app. ... It bombs on the connection. ...
    (microsoft.public.dotnet.framework.compactframework)
  • RE: Trouble connecting to SQL Server 2000 from Mobile Device
    ... > I am having trouble connecting to a SQL Server 2000 server on our network. ... But I get an SQLException when trying to run just ... Here is my simple app. ... It bombs on the connection. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Trouble connecting to SQL Server 2000 from Mobile Device
    ... thats for that information on the SQLException versus ... David ... >>I am having trouble connecting to a SQL Server 2000 server on our network. ... It bombs on the connection. ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Mobile 6 connection to SQL Express
    ... The SqlException should tell you a *lot* more. ... What's the error code in the ... Is there an inner exception? ... But if i try to make a "manual" connection to database i just got an ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Connection refused
    ... I am new to java, jsp and oracle, so I ask that you please be patient. ... I am attempting to create a context-param in web.xml for my connection ... SQLException: Io exception: Connection ... This error code may offer a clue that you can follow up. ...
    (comp.lang.java.databases)