Hi..
For my project i must run sql commands in IX.
For example 'select * from test6 order by id desc'. I want to ask this command and show the results on databaseviewer.
Thanks already.
How can I execute sql commands in IX?
Re: How can I execute sql commands in IX?
Well, the DatabaswViewer runs the SQL-queries for you, you just have to select the Database.sdf-file you wan't to fetch data from..
But if you are scripting something in iX Developer you can use ordinary connection-strings against a SQL Compact edition
http://www.connectionstrings.com/sql-server-2005-ce
But if you are scripting something in iX Developer you can use ordinary connection-strings against a SQL Compact edition
http://www.connectionstrings.com/sql-server-2005-ce
-
- Posts: 51
- Joined: Fri Apr 27, 2012 12:33 pm
Re: How can I execute sql commands in IX?
Dear bjornidar,
I already use to test my sql commands in Databaseviewer but in I wanted to say the databaseviewer object in developer program.
For example think that a button in the project and i write script into it as:
databaseviewer1.showdata();
When I lick the button the database viewer shows me the every data in the datababse ( eg. test 6 ) This is the reason I want to filter my datas
I hope I can tell myself
I already use to test my sql commands in Databaseviewer but in I wanted to say the databaseviewer object in developer program.
For example think that a button in the project and i write script into it as:
databaseviewer1.showdata();
When I lick the button the database viewer shows me the every data in the datababse ( eg. test 6 ) This is the reason I want to filter my datas
I hope I can tell myself
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: How can I execute sql commands in IX?
Hi memethemyn,
Have you tried using the following function?
You need the path to the database. On a T7A that path is, "\FlashDrive\Project\Database.sdf"
Have you tried using the following function?
Code: Select all
DatabaseViewer1.SendSelectQuery
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
-
- Posts: 51
- Joined: Fri Apr 27, 2012 12:33 pm
Re: How can I execute sql commands in IX?
Dear Mark..
I tried to use this code but the compiler occured error:(
The error is Unrecognized Escape sequence
thanks already..
PM: I'm new at scripting and C# so i ask forum many things. I hope this situation doesn't disturb you
I tried to use this code but the compiler occured error:(
Code: Select all
DatabaseViewer1.SendSelectQuery("select * from tes6","C:\Users\MEHMET\Desktop\Test Sistemi Yeni Tasarım\IX Tasarım\Project3\database.sdf");
thanks already..
PM: I'm new at scripting and C# so i ask forum many things. I hope this situation doesn't disturb you
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: How can I execute sql commands in IX?
I would suggest going through a few tutorials online, and reading up on C#. It is a very complex and powerful language.
Escape Sequences
String Literals
Code: Select all
DatabaseViewer1.SendSelectQuery(@"select * from tes6",@"C:\Users\MEHMET\Desktop\Test Sistemi Yeni Tasarım\IX Tasarım\Project3\database.sdf");
String Literals
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
-
- Posts: 824
- Joined: Tue Mar 13, 2012 9:53 am
Re: How can I execute sql commands in IX?
If you want to run a query on a database using the Database Viewer control on an iX panel that is running Windows CE, then you only need to use the name of the database. The application startup folder is automatically prefixed to the path when using the SendSelectQuery function.
That is not the case when running iX on a PC. Then you need to use the complete path to the database.
Code: Select all
DatabaseViewer1.SendSelectQuery(@"select * from DataLogger1",@"Database.sdf");
Best Regards,
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer
Mark Monroe
Beijer Electronics, Inc. | Applications Engineer