473,765 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Nchars as PrimaryKeys

markmcgookin
648 Recognized Expert Contributor
Hi All,

I am working on a project at the moment using SQL Server CE and in my login/user details database I have a user table with the individual username as a primary key.

I am trying to query this using entityspaces LoadByPrimaryKe y function, which works fine.... but only if the username is all text, if I throw a numeric character in there it always comes back false.

I can't understand this as they are all essentially characters, the DB knows they are not numeric values, and I have tried explicit convert.toStrin g type methods on the variable being passed, but none of this seems to work.

Does anyone have any ideas/solutions to this kind of thing? Or has anyone experienced it before.

Cheers,

Mark
Aug 7 '07 #1
2 1517
RedSon
5,000 Recognized Expert Expert
Is your database expecting a buffer of chars but you throw a number in there and interprets it as a value thereby making the array invalid?

This sounds more like a database engine problem then a embedded/mobile problem. What database are you using?
Aug 8 '07 #2
markmcgookin
648 Recognized Expert Contributor
Is your database expecting a buffer of chars but you throw a number in there and interprets it as a value thereby making the array invalid?

This sounds more like a database engine problem then a embedded/mobile problem. What database are you using?
It was SQL Server CE 3.0. I still have no idea why it was happening, but fortunatly I solved another problem that was forcing me to use the Nchar as the PK and now have a uniqueidentifie r guid based entity, thus avoiding having to deal with this problem! hehe :P
Aug 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
25874
by: alex | last post by:
how do i initialize an LPTSTR variable? i'm trying to call a microsoft function LONG QueryStringValue( LPCTSTR pszValueName, LPTSTR pszValue, ULONG* pnChars ) throw( );pszValue is supposed to get the value i want but i need to initialize it before i pass it to QueryStringValue, how do i initialize
19
10373
by: Lionel B | last post by:
Greetings, I need to read (unformatted text) from stdin up to EOF into a char buffer; of course I cannot allocate my buffer until I know how much text is available, and I do not know how much text is available until I have read it... which seems to imply that multiple reads of the input stream will be inevitable. Now I can correctly find the number of characters available by: |
5
2696
by: serge | last post by:
How can i enter Default Values of " " to all the columns of type character of all the tables (excluding system tables) and Default Values of 0 of all columns of type numbers. Excluding all primary key columns. Thank you
193
9635
by: Michael B. | last post by:
I was just thinking about this, specifically wondering if there's any features that the C specification currently lacks, and which may be included in some future standardization. Of course, I speak only of features in the spirit of C; something like object-orientation, though a nice feature, does not belong in C. Something like being able to #define a #define would be very handy, though, e.g: #define DECLARE_FOO(bar) #define...
5
1131
by: Lars Netzel | last post by:
Hello! I have 4 tables where the first is parent of the second and second parent of the the third and so on... These I need to have as Datagrids loaded from access (one grid for each table, not all tables in the same grid). Then I edit the values and then save back to the Access Database, keeping the relations. My problem is this:
6
2131
by: Gerrit | last post by:
Hello, I try to display the fieldnames and the primary key of a table, with this code: using System; using System.Collections.Generic; using System.Text; using System.Data; using System.Data.Odbc;
3
1258
by: ilan pillemer | last post by:
Hi, I have made an attempt at exercise 1.14 in K&R2: namely; "Write a program to print a histogram of the frequencies of different characters in its input." Here is my program and the output. #include <stdio.h>
0
2724
by: Sebastijan | last post by:
Hi I am interested in DbConnection.GetSchema method of ODP.NET oracle library. When I call (to get primary keys metadata) DataTable pkeys = DbConnection.GetSchema("PrimaryKeys"... foreach (DataRow dr in pkeys.Rows) { string pkTable = dr.ToString();
4
1581
by: Paul David Buchan | last post by:
Hello, I'm attempting to write a program to read in database files (.dbf). When I do it all as a single procedure in main, everything works. However, what I really want, is to pass the database filename to a function, and have it pass back an array containing the database contents, and some parameters telling me the dimensions of the array. I've succeeded in getting my function to read in the dbf file, and it returns the dimensions of...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9832
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7375
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3924
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.