Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hey guys, I encountered a problem while programing an app for windows mobile devices. So UI and database are all in place, the problem is when I press a button wich shuld retrive some data and fill a data grid this error occures

HTML
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, TdsParserState state)
  at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, TdsParserState state)
  at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()\r\n
  at System.Data.SqlClient.TdsParser.Connect(String host, SqlInternalConnection connHandler, Int32 timeout)\r\n
  at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin()\r\n
  at System.Data.SqlClient.SqlInternalConnection..ctor(SqlConnection connection, Hashtable connectionOptions)\r\n
  at System.Data.SqlClient.SqlConnection.Open()\r\n
  at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)\r\n
  at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)\r\n
  at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)\r\n
  at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)\r\n
  at RfidKnjiznicaTestSD.KnjiznicaDSTableAdapters.CustomerTableAdapter.GetData()\r\n   at RfidKnjiznicaTestSD.ObrazecZacetni.btnSkenirajStranka_Click(Object sender, EventArgs e)\r\n   at System.Windows.Forms.Control.OnClick(EventArgs e)\r\n
  at System.Windows.Forms.Button.OnClick(EventArgs e)\r\n
  at System.Windows.Forms.ButtonBase.WnProc(WM wm, Int32 wParam, Int32 lParam)\r\n
  at System.Windows.Forms.Control._InternalWnProc(WM wm, Int32 wParam, Int32 lParam)\r\n
  at Microsoft.AGL.Forms.EVL.EnterMainLoop(IntPtr hwnMain)\r\n
  at System.Windows.Forms.Application.Run(Form fm)\r\n
  at RfidKnjiznicaTestSD.Program.Main()\r\n"   string


Ok let me clarify this a little bit... I set up sql so it accepts tcp/ip connections, I put the correct connection string with all the required parameters, my emulated device (wich is windows mobile 5.0 pocket pc) is cradeled to the comp, but I still cant get this damn thing to work and display the data on the emulator.

If I run the same thing in a win forms project evrything works fine, so the stored procedures return the correct data.

Thank you for your answer!
Posted
Updated 30-Sep-12 6:34am
v5
Comments
Sergey Alexandrovich Kryukov 30-Sep-12 22:30pm    
This exception report is not comprehensive. I believe, important information is in InnerException of some of those exceptions. But main thing is: some code sample would really help.
--SA
pykos 1-Oct-12 12:46pm    
Well there really is not that much to it, I have a dataset where I set up my data adapters to return data(stored procedures) and I have a simple form, all that it does is it displays customerinfo, and when I call
KnjiznicaDS.CustomerDataTable stranka = customerAdapter.GetDataByCustomerId(Convert.ToInt32(txtIdStranke.Text));
the program chrashes with the above error. I set up the conn string the dataset.designer.cs file... maybe this is the problem...oh and inner exception says "could not evaluate expression"
thanx for the answer...
Sergey Alexandrovich Kryukov 1-Oct-12 13:05pm    
It looks like this is the SQL issue then. Well, find out which SQL and show the relevant code.

As to the InnerExceptions, you need to include them all in the report. For this purpose, catch all exceptions in some point (at least once at the top stack frame of each thread), and report exception information with InnerException. But as the InnerException is Exception, so it also can have InnerException, so always do it recursively.
--SA
pykos 1-Oct-12 13:12pm    
hmm, I dont think I understand you...What do you mean with "find out wich sql"? Im using VS 2008 with sql server express 2008. As I said sql queries return data in the appropriate manner if im using win forms app. It just doesnt work with win mobile...
here is the conn string:
"Data Source=xxx.xx.xx.xxx\\sqlexpress;Initial Catalog=Library;Integrated Security=SSPI;User ID=sa;Password=xxxxxx;" is this in correct format?

thank you for helping :)
Sergey Alexandrovich Kryukov 1-Oct-12 14:14pm    
Sorry for not being clear. I suggested to find out the SQL statement (query) -- it could be the real reason for this InnerException. Find out the SQL statement string and show it in the question body.

I don't think the connection string is the problem here. And -- I think you already has the evidence that the connection is established, don't you?
--SA

1 solution

Hello

I have exactly the same problem


I'm working from my WIN 7 Laptop, I can acces the database from a csharp application running on the laptop

However if I run an application from a WinCE device in Debug from the same laptop I get the error

But it was working fine a few month ago

One of the difference is that in the Meantime I've installed VS 2013 on the Laptop so VS 2013 is co-existing with VS 2008 maybe there is a conflict somewhere
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900