Re: exception error when accessing SQL database

From: William \(Bill\) Vaughn (billvaRemoveThis_at_nwlink.com)
Date: 09/27/04

  • Next message: William \(Bill\) Vaughn: "Re: DataSet to Database help"
    Date: Mon, 27 Sep 2004 11:39:45 -0700
    
    

    I would pick up a copy of Paul Yao and Dave Durant's book on .NET Compact
    Framework Programming (Addison Wesley). They explain the differences and
    limitations of the CF implementation.

    -- 
    ____________________________________
    William (Bill) Vaughn
    Author, Mentor, Consultant
    Microsoft MVP
    www.betav.com
    Please reply only to the newsgroup so that others can benefit.
    This posting is provided "AS IS" with no warranties, and confers no rights.
    __________________________________
    "whitetulips" <whitetulips@discussions.microsoft.com> wrote in message 
    news:4D9B43EB-5A10-480D-B86A-702E292F923D@microsoft.com...
    > hi,
    >    Yes, this is a program designed for Pocket Pc 2003. The objective of my
    > project is to do a windows application that does data mining and complex
    > calculations on the extracted data, working against the memory and
    > computational limits of the Pocket PC PDA.
    >
    >    What do u mean by another type of ADO? I tot there's just ADO .NET? Can
    > you please explain or give any suggestion possible?
    >
    >    Meanwhile, I am doing up the GUI for my program and having lots of fun.
    > =) At least there's something comforting.
    >
    > thks,
    > lynn.
    >
    >
    > "William (Bill) Vaughn" wrote:
    >
    >> Yes, that's another set of issues. So this is really a program designed 
    >> for
    >> a Windows Mobile phone or Pocket PC? This uses another type of ADO 
    >> entirely.
    >>
    >> -- 
    >> ____________________________________
    >> William (Bill) Vaughn
    >> Author, Mentor, Consultant
    >> Microsoft MVP
    >> www.betav.com
    >> Please reply only to the newsgroup so that others can benefit.
    >> This posting is provided "AS IS" with no warranties, and confers no 
    >> rights.
    >> __________________________________
    >>
    >> "whitetulips" <whitetulips@discussions.microsoft.com> wrote in message
    >> news:F8EB3BB5-6046-48BC-A51F-5577C1D48203@microsoft.com...
    >> > Hi Val Mazur and Bill,
    >> >
    >> > I have just figured out what you meant by "ASP.NET environment". No, I 
    >> > am
    >> > not doing an ASP.NET application. I am doing a "Smart Device Windows
    >> > application".
    >> >
    >> > Does it make the situation very different now?
    >> >
    >> > thks and rdgs,
    >> > Lynn
    >> >
    >> >
    >> > "Val Mazur" wrote:
    >> >
    >> >> Hi,
    >> >>
    >> >> When you code executes as ASP.NET application, then this application 
    >> >> runs
    >> >> under control of ASPNET user, which is predefined user in Windows
    >> >> environment. By-default this user has minimum privileges and is not
    >> >> allowed
    >> >> to access SQL Server unless you add it to the logins of the SQL Server
    >> >>
    >> >> -- 
    >> >> Val Mazur
    >> >> Microsoft MVP
    >> >>
    >> >>
    >> >> "whitetulips" <whitetulips@discussions.microsoft.com> wrote in message
    >> >> news:0EBF92E0-4CD9-4A7A-A5F6-DB9F8E83B23E@microsoft.com...
    >> >> > hi
    >> >> >
    >> >> > I am sorry, are you refering to this: The error output from the 
    >> >> > message
    >> >> > window was "An unhandled exception of type
    >> >> > 'System.Data.SqlClient.SqlException' occurred in
    >> >> > System.Data.SqlClient.dll"?
    >> >> >
    >> >> > by the way, what you mean by asp.net environment? (pardon me cos i m
    >> >> > really
    >> >> > a newbie -_-")? From my understanding of asp, it's a transportation
    >> >> > language
    >> >> > to send my sql queries to the server to retrieve the data. The asp
    >> >> > codes,
    >> >> > together with the sql codes, are placed within html codes. The data
    >> >> > extracted
    >> >> > are then displayed in a web form. However, I am not displaying my 
    >> >> > data
    >> >> > extracted from the database on a web form. The data are simply
    >> >> > displayed
    >> >> > in a
    >> >> > data grid(for eg.), within a window, which will appear in the screen 
    >> >> > of
    >> >> > the
    >> >> > pda emulator. And I followed some sample codes in a "Teach yourself
    >> >> > ADO.NET"
    >> >> > book to access the database. How will that be confused with asp.net?
    >> >> >
    >> >> > pardon me and thanks,
    >> >> > lynn
    >> >> >
    >> >> >
    >> >> > "Val Mazur" wrote:
    >> >> >
    >> >> >> You still did not post actual exception here. Do you run your code
    >> >> >> from
    >> >> >> ASP.NET environment? If yes, then most likely you just do not have
    >> >> >> permissions for ASPNET account to connect to the database. In a 
    >> >> >> case
    >> >> >> if
    >> >> >> you
    >> >> >> test it from the development environment it will work, because you 
    >> >> >> do
    >> >> >> it
    >> >> >> from the Windows environment for the local user
    >> >> >>
    >> >> >> -- 
    >> >> >> Val Mazur
    >> >> >> Microsoft MVP
    >> >> >>
    >> >> >>
    >> >> >> "whitetulips" <whitetulips@discussions.microsoft.com> wrote in 
    >> >> >> message
    >> >> >> news:CF66A6AD-62ED-4F51-BDFE-8E7D3CEA624E@microsoft.com...
    >> >> >> > hihi
    >> >> >> >
    >> >> >> >    It gave an unhandled exception. However, this operation should
    >> >> >> > not
    >> >> >> > give
    >> >> >> > an exception. That is why I did not write an a try n catch for an
    >> >> >> > exception.
    >> >> >> > I wonder if it's because I failed to connect to the database.
    >> >> >> >    However, I did try to use the option "Tools"->"Connect to
    >> >> >> > Database"
    >> >> >> > to
    >> >> >> > test the connection between my visual studio .net and the 
    >> >> >> > database.
    >> >> >> > It
    >> >> >> > says
    >> >> >> > "Test Connection Succeeded."
    >> >> >> >    Also, I tried to change the (local) to the actual server name 
    >> >> >> > and
    >> >> >> > and
    >> >> >> > it's still the same. ie. "SqlConnection cn = new
    >> >> >> > SqlConnection(@"server=baby\NetSDK; DataBase=pubs;Integrated
    >> >> >> > Security=SSPI");" , given that baby(for eg.) is the server name. 
    >> >> >> > I
    >> >> >> > have
    >> >> >> > also
    >> >> >> > tried (baby), but to not avail. I even tried "BABY" which is the 
    >> >> >> > SQL
    >> >> >> > server's
    >> >> >> > name, though I know that's dumb and indeed it's of no help. -_-"
    >> >> >> > cause
    >> >> >> > I
    >> >> >> > am
    >> >> >> > really desparate.. =(
    >> >> >> >
    >> >> >> >    By the way, what's the difference between the 2 statements in 
    >> >> >> > the
    >> >> >> > following? What's the significance of the "@", the brackets in
    >> >> >> > "(local)"
    >> >> >> > and
    >> >> >> > "\NetSDK"? And what's the difference in the syntax "local" and
    >> >> >> > "localhost"?
    >> >> >> > 1) SqlConnection cn = new SqlConnection("Initial 
    >> >> >> > Catalog=pubs;Data
    >> >> >> > Source=localhost;Integrated Security=SSPI;");
    >> >> >> > 2) SqlConnection cn = new SqlConnection(@"server=(local)\NetSDK;
    >> >> >> > DataBase=pubs;Integrated Security=SSPI");
    >> >> >> >
    >> >> >> >    Please help.
    >> >> >> >
    >> >> >> > thks.
    >> >> >> > lynn
    >> >> >> >
    >> >> >> >
    >> >> >> > "Val Mazur" wrote:
    >> >> >> >
    >> >> >> >> Hi,
    >> >> >> >>
    >> >> >> >> What kind of exception do you get? try to replace (local) with 
    >> >> >> >> the
    >> >> >> >> actual
    >> >> >> >> server name
    >> >> >> >>
    >> >> >> >> -- 
    >> >> >> >> Val Mazur
    >> >> >> >> Microsoft MVP
    >> >> >> >>
    >> >> >> >>
    >> >> >> >> "whitetulips" <whitetulips@discussions.microsoft.com> wrote in
    >> >> >> >> message
    >> >> >> >> news:2A6247C7-0C32-4D20-B9ED-21A7583E689E@microsoft.com...
    >> >> >> >> > Dear all,
    >> >> >> >> >    I am using visual studio .net and c# to develope mobile
    >> >> >> >> > applcations
    >> >> >> >> > and
    >> >> >> >> > I am new to both. I used the following code under the option
    >> >> >> >> > "visual
    >> >> >> >> > c#
    >> >> >> >> > project", "Smart device application". It was successfully 
    >> >> >> >> > built,
    >> >> >> >> > but
    >> >> >> >> > the
    >> >> >> >> > execution got stuck with exception error when it hit the line
    >> >> >> >> > /*dr =
    >> >> >> >> > cmd.ExecuteReader(CommandBehavior.CloseConnection);*/.
    >> >> >> >> >
    >> >> >> >> > private void UseDataReader_Click(object sender, 
    >> >> >> >> > System.EventArgs
    >> >> >> >> > e)
    >> >> >> >> > {
    >> >> >> >> > listBox1.Items.Clear();
    >> >> >> >> > SqlConnection cn = new SqlConnection(@"server=(local)\NetSDK;
    >> >> >> >> >                                  DataBase=pubs;Integrated
    >> >> >> >> > Security=SSPI");
    >> >> >> >> >
    >> >> >> >> > SqlDataReader dr;
    >> >> >> >> > SqlCommand cmd = new SqlCommand();
    >> >> >> >> > cmd.CommandText = "Select au_lname, au_fname from Authors";
    >> >> >> >> > cmd.Connection = cn;
    >> >> >> >> > cn.Open();
    >> >> >> >> > dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
    >> >> >> >> > .......................
    >> >> >> >> > }
    >> >> >> >> >
    >> >> >> >> > I had the similar problem before when I was working with the
    >> >> >> >> > option
    >> >> >> >> > "visual
    >> >> >> >> > c# project", "Windows Application". But the execution was fine
    >> >> >> >> > after
    >> >> >> >> > i
    >> >> >> >> > changed the database connection statement to /*SqlConnection 
    >> >> >> >> > cn =
    >> >> >> >> > new
    >> >> >> >> > SqlConnection("Initial Catalog=pubs;Data
    >> >> >> >> > Source=localhost;Integrated
    >> >> >> >> > Security=SSPI;");*/. However, this does not seem to solve the
    >> >> >> >> > problem
    >> >> >> >> > here.
    >> >> >> >> >
    >> >> >> >> > Can anyone help?
    >> >> >> >> >
    >> >> >> >> > thks
    >> >> >> >> > lynn
    >> >> >> >>
    >> >> >> >>
    >> >> >> >>
    >> >> >>
    >> >> >>
    >> >> >>
    >> >>
    >> >>
    >> >>
    >>
    >>
    >> 
    

  • Next message: William \(Bill\) Vaughn: "Re: DataSet to Database help"

    Relevant Pages

    • Re: exception error when accessing SQL database
      ... I have just figured out what you meant by "ASP.NET environment". ... I am doing a "Smart Device Windows ... > to access SQL Server unless you add it to the logins of the SQL Server ... >> together with the sql codes, ...
      (microsoft.public.data.ado)
    • Re: I couldnt change authentication to mixed mode. Why?
      ... SQL Server must be restarted. ... restarted SQL Server after changing the authentication method. ... Windows and SQL Server Authentication. ... "Login Failed for user Bill. ...
      (microsoft.public.sqlserver.security)
    • Re: Slow booting xp home.
      ... Changing the boot order to boot first from your hard disk might save you a half second, but you won't be able to boot from a CD until you change it back - and the time spent to do that will erase any previous time saved. ... 2- Consider what software you really want to start with Windows and also how you've configured your applications at startup ... Installing and Registering Visual Studio Express Editions Smart Device ...
      (microsoft.public.windowsxp.perform_maintain)
    • Re: Slow booting xp home.
      ... Thirty seconds to boot Windows? ... I read somewhere that Microsoft suggest 30s boot up on xp home, I have seen videos on youtube of 8s boot up on xp, I'd be delighted with 30s and happy just to get below a minute. ... Installing and Registering Visual Studio Express Editions Smart Device ...
      (microsoft.public.windowsxp.perform_maintain)
    • Re: System Information Unavailable on XP Pro
      ... Bill, ... Open a Command Prompt window and enter the following commands, ... > You can see I'm multibooting, where WinXP is on partition ... >>> received the reply, "The Windows Management ...
      (microsoft.public.windowsxp.security_admin)

    Loading