C# Linq Database Query has no results - General Questions and Answers

Hello,
I wonder if anyone can help me with this:
I've been trying to query Northwind.sdf but for some reason it refuses to return any hits.
I can connect to the database in runtime through Binding Sources and all but
my query just remains fruitless.
//================
NorthwindDataSet db = new NorthwindDataSet();
var products = from p in db.Products
where p.English_Name == "Outback Lager"
select p;
foreach (var c in products)
{
listBox1.Items.Add("test");
}
//================
Is there maybe anything I've overseen ?
The compiler is fine with it.
I work with Visual Studio 2008 Professional.
Thank you in advance

Linq to Sql isn't supported by the .net 3.5 CF!

Well that would most certainly explain it !
Thank you.

Related

Wanting to develop for WM haivng some problems

Hi I want to make an application using location, I found this tutorial
http://msdn.microsoft.com/en-us/library/dd938890.aspx#RetrievingLocationInformationthroughGPS
which looks very helpful but because I am new to visual studio I am having some problems.
1) is the article it says "This article includes complete sample code." but I cant find a download for all the code.
2) he only mentions referencing Microsoft.WindowsMobile.Samples.Location.dll which I have done but the class LatLong is still unknown
3) I made a sample program without the LatLong class just to experiment I get the following error on my device
"Microsoft.WindowsMobile.Samples.Location, Version=1.0.3448.25673, Culture=neutral, PublicKeyToken=null, or one of its dependencies, was not found
any idea what this means?
4) Could all my problems be because I am using visual studio 2005 and not 2008? I found a code project that looked really helpful but when trying to open it it says that it cant because it is from a newer version of the software, anything that can be done?
5) I find MSDN confusing for finding out what to reference to add a class for example this is the page for the LatLong class http://msdn.microsoft.com/en-us/library/cc514548.aspx
with the java online info the first thing you always see is where the class is found but it seems to be missing for this class. Other basig classes appear similar to java.
below is my sample code its basically taken from the article but I have commented out the references to LatLong and put in checks instead
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsMobile.Samples.Location;
namespace DeviceApplication3
{
public partial class Form1 : Form
{
private Gps gps;
int count = 0;
public Form1()
{
InitializeComponent();
gps = new Gps();
gps.Open();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = (getGpsString());
}
private string getGpsString()
{
GpsPosition position = gps.GetPosition();
/*LatLong location = new LatLong();
if (position.LatitudeValid)
location.Latitude = position.Latitude;
if (position.LongitudeValid)
location.Longitude = position.Longitude;
if (position.HeadingValid)
location.Heading = position.Heading;*/
StringBuilder sb = new StringBuilder();
sb.Append("\n");
sb.Append("Latitude = ");
if (position.LatitudeValid)
{
sb.Append(position.Latitude.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
sb.Append("Longitude = ");
if (position.LongitudeValid)
{
sb.Append(position.Longitude.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
sb.Append("Heading = ");
if (position.HeadingValid)
{
sb.Append(position.Heading.ToString() + "\n");
}
else
{
sb.Append("Not found yet\n");
}
return sb.ToString();
}
}
}
Microsoft.WindowsMobile.Samples.Location.dll
is this file located in bin\debug and or \bin\release
?
and does it only give runtime errors or also compile time ?
no it compiles fine, can you see anything wrong with my code? The weird thing is the form comes up using the emulator but not on the device. Could it be because I have a custom rom that seems to have compact framework 3.5? I would assume it would be back compatible?
How have you deployed it to the device? Have you copied the .exe and the Location.dll?
one thing you could also test was if you could disable the stuff in the gps
and just run a program without it to verify that it's not missing net3.5's fault
heliosdev said:
How have you deployed it to the device? Have you copied the .exe and the Location.dll?
Click to expand...
Click to collapse
Hi thanks for this I didnt copy over the dll I'm very silly.
So what do you guys think about loading projects ment for vs 2008 in 2005 is this impossible ? or can i convert them somehow?
sure it's only the project and solution files which differ
add the cs files manualy and it should work fine
Use the same name to create the new project in vs2005 to have the same namespace.
You'll have to do some manual changes if the code uses c#3.0 .net 3.5 features.
Thanks guys your awesome,
very random and off topic but since your programming kings ill ask anyway,
I think I want to eventually work in the gaming industry, I'm close(3months) to finishing my MSc CompSci conversion course and I am looking for jobs, its quite aparent that most games companys don't want unexperienced people so do you guys have any ideas of places to apply for that will give the the necessary experience? btw I have no taught experience with C++ which I think is my biggest dissadvantage, I do know C and java quite well though and as you can tell just starting to play with C#.
your help is always appreciated.
well, continue with general programming (object oriented programming, ui development, database, network,...). There are so many different fields in software development!
For example take a look at the chapters of the books in the game programming gems series to see what (not only) gaming companies are working on. In general for beginning there is a lot of information online where you'll find tons of tutorials.
Try to get a profound base in programming.
Starting with your gps application, develop a gui, save/load the positions (database), visualize the points...
heliosdev said:
well, continue with general programming (object oriented programming, ui development, database, network,...). There are so many different fields in software development!
For example take a look at the chapters of the books in the game programming gems series to see what (not only) gaming companies are working on. In general for beginning there is a lot of information online where you'll find tons of tutorials.
Try to get a profound base in programming.
Starting with your gps application, develop a gui, save/load the positions (database), visualize the points...
Click to expand...
Click to collapse
Hi sorry for the late reply I upgraded to windows 7 last night to try and improve my rubbish laptop, seems to be a bit better btw,
anyway just want to say thanks for the advice. also my app will use google maps yahoo zonetag and windows live earth (or bing maps if thats what there calling it now) I think for some of thoes services I will need to pay to realease my app to the public even if its free but what about testers would I be able to give it to say 10 people?

[SDK]HD2MultitouchSDK

Beta-Version is out!!
Multitouch for everyone!!!!
HD2Multitouch is for all who want to support multitouch on the HD2 in their apps like the Album-App does.
This is the really first version, so don't expect a perfect solution....
And it's free, so start developing....
Getting started:
Code:
public YourForm()
{
InitializeComponent();
bool doRestart;
multitouch = Multitouch.GetMultitouch(this, out doRestart);
if (doRestart)
{
MessageBox.Show("To activate the multitouch, the app will perform a restert now.", "Multitouch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
Multitouch.PerformSoftReset();
this.Close();
return;
}
if (multitouch == null)
{
MessageBox.Show("Failed to initialize the multitouch.", "MultitouchDemo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
this.Close();
return;
}
multitouch.TouchDown += new EventHandler<MultitouchEventArgs>(multitouch_TouchDown);
multitouch.TouchUp += new EventHandler<MultitouchEventArgs>(multitouch_TouchUp);
multitouch.TouchMove += new EventHandler<MultitouchEventArgs>(multitouch_TouchMove);
multitouch.EnableEvents = true;
}
Please note (if you download the app you agree!):
The SDK is provided 'as is'
The developer does NOT give any warranty of any kind and can't be held for any damage or loss caused directly or indirectly by the SDK (just in case)
The developer does NOT guarantee any kind of support (but I'll try to help everyone )
You're not allowed to develope commercial apps with this sdk. Your app and the sdk MUST be sold free. For commercial prjects contact the developer.
You are not allowed to disassemble the SDK or reverse engineer it.
you are not allowed to post the attachement(s) below to any other website. you can always link to this tread.
If you are going to use it in your application, you MUST put a link in your application/offical website that reffers to this XDA thread.
The developer reserves the right to make this a paid SDK at any point of time.
The developer reserves the right to relocate this SDK to another website or even take it offline.
Reserved for futere posts...
Reserved. (the last one)
hi Dude...i am a very newbies for this and i own a hd2...
i had download the file and now how i suppost to do? where i should i put the file??
Thanks...
sorry for a stupid question...
Hey
I'm not sure what you're trying to get. The file you downloaded is a sdk (which means software development kit), so it's meant to use it in your own project, but if you aren't a developer, there's no need for the sdk on your hd2...
Cheers

[Q] How to identify windows Phone 7 is connected to pc by USB cable?

Hi all,
i am working for VC++, please tell me how can i identify here the Windows Phone 7 is connected to PC By USB cable .
thanks in advance.
You should be more specific. Where you need identify connection: on the handset or on PC? BTW, C++ isn't supported by WP7 SDK (C# and VB only).
I want to identify connection on PC .
is there any option n c# to identify this please tell me.
AFAIK, there is no WP7 API or documentation for this from PC side (but probably you can find something in WinMo 6/6.5 SDK's), however you can monitor and detect Zune run or get background task on WP7 telling you what kind of connection handset is using right now.
P.S. Take a look to the http://msdn.microsoft.com/en-us/library/bb840031.aspx , also check this thread http://forum.xda-developers.com/showthread.php?t=1016766
I believe it's possible using Windows CE/Windows Mobile "old technique" ('cause WP7 based on WinCE 7.0 and CE services).
so please tell me how?
Also you can use Microsoft.Smartdevice.Connectivity assembly but it's not a best way (no events defined, you should pull device for connection periodically).
Code:
using Microsoft.SmartDevice.Connectivity;
static DeviceInfo[] GetDevices()
{
List<DeviceInfo> list = new List<DeviceInfo>();
try
{
DatastoreManager manager = new DatastoreManager(0x409);
foreach (Platform platform in manager.GetPlatforms())
foreach (Device device in platform.GetDevices())
list.Add(new DeviceInfo(platform.Id.ToString(), device.Id.ToString(), device.Name));
}
catch {}
return list.ToArray();
}
static bool IsDeviceConnected (DeviceInfo deviceInfo)
{
bool bResult = false;
try
{
DatastoreManager manager = new DatastoreManager(0x409);
Device device = manager.GetPlatform(new ObjectId(deviceInfo.PlatformId)).GetDevice(new ObjectId(deviceInfo.DeviceId));
bResult = device.IsConnected();
}
catch {}
return bResult;
}
Of course it's just a prototypes. Actually you need to get device once and periodically pull .IsConnected().
error ::comes when i use this.
error CS0234:The type or namespace name 'SmartDevice' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)
error CS0246: The type or namespace name 'DeviceInfo' could not be found (are you missing a using directive or an assembly reference?)
Click to expand...
Click to collapse
sensboston said:
AFAIK, there is no WP7 API or documentation for this from PC side (but probably you can find something in WinMo 6/6.5 SDK's), however you can monitor and detect Zune run or get background task on WP7 telling you what kind of connection handset is using right now.
P.S. Take a look to the http://msdn.microsoft.com/en-us/library/bb840031.aspx , also check this thread http://forum.xda-developers.com/showthread.php?t=1016766
I believe it's possible using Windows CE/Windows Mobile "old technique" ('cause WP7 based on WinCE 7.0 and CE services).
Click to expand...
Click to collapse
have u ever tried this ?
please help.
[email protected] said:
please help.
Click to expand...
Click to collapse
Watch this video, it will explain your needs completely!
P.S. Always try 2google first! Nobody will do your job for you...
thread moved to Q&A

[Q] Android 2.2 progammically tell if Bluetooth Headset connected on start

I am programming for android 2.2 API Level 8 and I am trying to find out if there is currently a bluetooth headset connected when my application starts initially. I can not seem to find a solution to this issue.
Once my application is up and running I can listen for BluetoothDevice.ACTION_ACL_CONNECTED and BluetoothDevice.ACTION_ACL_DISCONNECTED as denoted here which works great mind you. But I can't figure out how to tell before the BroadcastReceiver is on if there is currently a bluetooth headset connected.
I am hoping that someone out there already has a solution to this issue for API Level 8. I do realize that in API 11 there are some new classes such as BluetoothProfile and BluetoothHeadset that could probably do this in 1 line of code, but again I am trying to do this in API Level 8
I am willing to try anything at this point.
Thanks in advance
-H
Something like this
http://stackoverflow.com/questions/4544042/how-to-detect-if-bluetooth-device-is-connected
maybe?
You probably will have to find out if one of the devices is a headset...
Nope. That only shows the paried or configured bonded devices that have been at some point bonded/paired to the device.
which can be simply done like this
Code:
BluetoothAdapter mBluetoothAdapter = null;
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if(mBluetoothAdapter != null)
{
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
if (pairedDevices.size() != 0)
{
// the device has paired devices
for (BluetoothDevice device : pairedDevices)
{
Log.i(TAG, "device name: " + device.getName());
Log.i(TAG, "device address: " + device.getAddress());
}
}
else
{
// no paired devices
Log.i(TAG, "no paired devices");
}
}
I had stumbled across this
http://stackoverflow.com/questions/...g-a-private-unpublished-method-in-android-api
but I am new to reflection and very rusty with java. I was not able to get it to work as expected nor did I see anyone else get this answered.
I did find http://java.sun.com/developer/technicalArticles/ALT/Reflection/ which was super useful for refection.
Any advice/help/suggestions/code would help me tons.

Help for starting developing

Hi Guys,
I wanna start developing apps for the gearS2. Foir now I have some experience with html and several other languages mainly for windows applications and also last programming job was like 6 years ago so I'm not really up to date with all the different options for developing.
For start I tried to use the tizen SDK but I'm a little lost due to the variaty of options and also the quite buggy SDK. Installing the 2.4 SDK left me with an error for the simulator (hax not working). I t hink i got arround this by installing this manually. Emulator works now but for example the UI builder doesnt work. So my thought is to start a web app with tau as this seems to work quite reliable. My goal is to write a basic control of my hue lights (I know there is an app for that but I wanna try to build my own). My plan is to use an java lib for the hue commands and do the rest via the tau/html/javascript.
Now my question is if anyone can give me any advice on how to start developing. Does my plan seem valid. Can anyone help me or give me some tips? Maybe I'm missing something or someone just has some shortcuts.
Thanks in advance.
Björn
Hi.
I found this "howto" : http://www.tizenexperts.com/2015/12/how-to-deploy-to-gear-s2-smartwatch/
It helped me to successfully deploy a project sample on my gear s2 folllowing these steps :
- install sdk
- generate & configure author certificate.
- download, compile and run/deploy a project sample on the gear s2 (SensorBall).
During the "Request the Certificate" step, I ran into this java exception :
Unhandled event loop exception No more handles [Unknown Mozilla path (MOZILLA_FIVE_HOME not set)]
Click to expand...
Click to collapse
I'm on "debian jessie" with "openjdk7":
If this happens:
- install package "libwebkitgtk-1.0-0"
- add "-Dorg.eclipse.swt.browser.DefaultType=webkit" to you "eclipse.ini" file
- restart tizen.
At the end, you'll have a new app installed on your watch. You can recognized it with the tizen icon.
I hope this can help you.
Bye.
thank you for your feedback akaiah.
I found this site earlier, requested a certificate but then I couldnt find the site again. So thx for the link.
My problems are more linked to
a) the general structure of webapps for tizen
b) rusty coding skills (last time i coded was 6 years ago and mainly c# / object pascal for windows)
c) problems with tau / it's documentation
Maybe someone can help with a few detailed questions.
First question is regarding the online samples. I've found the following code in one sample for wearables (calendar app) but I don't know what this is and if I should be using stuff like this. It doesn't look like standard javascript to me but I can't find any API/library included either:
Code:
/**
* App module.
* @requires {@link Calendar/views/initPage}
* @namespace Calendar/app
* @memberof Calendar
*/
define({
name: 'app',
requires: [
'views/initPage'
],
def: function appInit() {
'use strict';
/**
* Initializes the app.
* @memberof Calendar/app
*/
function init() {
console.log('app::init');
}
return {
init: init
};
}
});
Second question is regarding jquery. Which version should I use and how am I supposed to include this? I'm using the 2.4 SDK download but programming a wearable web app with 2.3.1. I tried inlcuding jquery by downloading the latest version 2.1.4 (uncompressed) and putting it in my lib file folder, then including it in the html header. I have the feeling though that this is causing some issues. E.G. some notations don't work:
Code:
$( "#divname" ).innerHTML = "newtext";
doesnt work. No error just no result.
Third question is regarding tau. I tried to create a popup and register a callback for the popupafterclose-event like this but it doesn't work (event is not fired)
HTML:
<!--Popup HTML code-->
<div id="popup" data-role="popup">
<p>This is a completely basic popup, no options set.</p>
</div>
<script>
// Use popup events
var popup = document.getElementById("popup");
popup.addEventListener("popupafteropen", function()
{
// Implement code for popupafteropen event
});
</script>
taken form HERE
What am I doing wrong here? Is this the correct API im looking here or maybe does it collide with the jquery library?
For any tips I would be very thankfull.
Greetings
Björn
Wow thanks finally some one. I wold love to root my device ..
If theres a way.
If anyone was wondering about this issue, I kind of got this solved.
I just started an new project copied over all code and removed my jquqery imports and the code that gave me errors before just works fine. TAU in generell seems to be quite buggy and is easily be destroyed by an "unlucky" combination of UI changes (opening a popup or another window).
Even a week later I still don't know what the code in the calendar sample is from and tau seems not to be the most stable library out there. If anyone else has trouble starting developing for this I'm happy to share more experiences.
Greetings from germany

Categories

Resources