try{
string str="Data Source=ServerIP;Initial Catalog=DB;User ID=ID;Password=PW;";
SqlConnection connection = new SqlConnection(str);
connection.Open();
SqlDataAdapter adapter = new SqlDataAdapter("Select Top 1 A From ATable",connection);
}
catch(Exception e)
{
MessageBox.Show(e.Message);
}
development environment It is a PDA with WinCe 6.0 OS.
Many problems arose, and these problems may be related to the current problem.
- When the exe program is executed, the message NETCF35.Message.EN.cap OR NETCF35.Message.EN.wm.cap is displayed and the program ends
--> PDA is WinCe6.0 not WindowMobile. So in the NET35.Message.EN.Cap file I renamed SYCCFA~1.001 to System.SR.dll and referenced it in my project.
After doing #1, another error occurred.
"There is no row at position 0." Of course if (dt.Rows.Count > 0) you have to handle the exception, but I checked that the data in the table exists. There is no WHERE conditional statement, and the data exists unconditionally. So I added try-catch for all functions GetDataTable and Connection in SQL.cs file.
This is the second error. 2. platform not supported exception --> The code attached above is a function, where a platform unsupported exception is thrown. Tried both System.Data.SqlClient and Microsoft.Data.SqlClient references.
The problem ends here. We will tell you the current situation to solve the problem. 1.On my local pc it works perfectly. 2. It works on other PDAs with the same OS. So it seems to be a PDA problem, but I couldn't find the cause. I wonder if you have successfully solved the problem in question 1 above. If it worked successfully, please point out other reasons or issues that are causing the error.