|
You are just showing how little you know about Java. I don't know much either, but I can read the reference doc.
In short, Character.getNumericValue returns a code from an internal vm table known as the UAT (Unicode Attribute Table). As a result, this returns what you may call "weird" numbers.
To get the unicode from a char, you just need to cast it.
int unicodevalue = (int) 'b';
PS : Java being a joke?
Ha ha!!!!
How low can you go ? (MS rant)
|
|
|
|
|
Hi All,
Is it possible to create an Access DB "on the fly" using ADO? If not is there any other method?
Thanks,
J.
|
|
|
|
|
Wrong forum! Post in SQL/ADO forum.
"There are no stupid question's, just stupid people."
|
|
|
|
|
Here's an answer from google
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
|
I wanted to do just that without having to include an interop assembly. I just created a blank db in Access and added it as a resource to my project. Then whenever I wanted to create a new blank db I just created a new file and streamed out the binary resource data for the mdb. Probably wouldn't get your program a "Designed for" Windows sticker, but it works.
|
|
|
|
|
Hi all,
Does anyone have an idea how to create charts in C#?
Or of any tutorials on how to create them?
Thanks,
J.
|
|
|
|
|
Yes, I've done a series of articles on GDI+, they are in C++ but the methods are the same in C#.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Does anyone know how I can find out the SQL Server type of a db column from within C#. I know that when I obtain data in a DataTable, each of the DataColumn objects contain information about the column including the column name and the data type, however, the type that it provides is a System.* C# type. Is there any way to determine the SQL Server type name (e.g. int, smallint, etc.) programmatically?
TIA
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi
I presume you have a DataSet to transfer the data? Well, just look in there
"There are no stupid question's, just stupid people."
|
|
|
|
|
I've been looking in there through the debugger as well as in the DataTable and DataColumn and I don't see anything that would tell me the type or the length of the individual columns. Do you know of something more specific?
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Your dataset contains the mapping from SQL types to .NET types, if you dont have a dataset (which I doubt), just get one of the data adapters auto generate u one. Then double click that file (the .xsd file) and it will show the equivalent SQL types. For the length of each type (of each parameter), that too get auto generated if you are using stored procedures.
Hope this helps
"There are no stupid question's, just stupid people."
|
|
|
|
|
You say that "Your dataset contains the mapping from SQL types to .NET types...". I do have a DataSet, I just don't know where this mapping is that you are referring to. What member of the DataSet contains this information? You understand that I want to obtain this info programmatically, right?
Thanks again.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
perlmunger wrote:
You understand that I want to obtain this info programmatically, right?
No, but i do now
<dataset instance="">.<tablename>.Columns["Usersorwhatever"].....oh damn I have no idea, where that takes place... You can find out the .NET types, so I assume the cast from SQL to .NET is auto, inserting values u need the SqlType and width though, so I'm not sure how this is done. I will look tomorrow, I need some desperate sleep
"There are no stupid question's, just stupid people."
|
|
|
|
|
I would avoid to use the dataset because at this point they have already done some type mapping (either CTS, or XSD).
Here is the code for retrieving the internal SQL Server data type for any database table columns :
DataTable oTable = new DataTable();
SqlDataAdapter oAdapter = new SqlDataAdapter("SELECT * FROM INFORMATION_SCHEMA.COLUMNS", m_oConnection);
This stores the result of the system query in oTable. Then you just need to lookup the rows of this table. Interesting columns are of course "COLUMN_NAME" and "DATA_TYPE".
If you have SQLServer installed, I guess this kind of things should be known by you a million times already, because you can see these things in the SQL Enterprise manager GUI.
How low can you go ? (MS rant)
|
|
|
|
|
I finally found a similar answer on google this morning. I am new to SQL Server, so I had no idea. Thanks for your help.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
I'm not sure what is going on here, but I hope there's someone who knows why this happens. Basically, I have a base class and an inherited class, something like this:
public abstract class Base {}
public class Inherited : Base {}
I also have a class that populates inherited objects called ObjectBuilder. It is a singleton and it has a method called PopulateObject. Here is the code to do what I want:
Inherited i = new Inherited();
ObjectBuilder ob = ObjectBuilder.GetInstance();
ob.PopulateObject( ref i );
The problem is that the signature for PopulateObject takes a ref to Base. If I understand the is-a relationship properly, doing so should work and in fact, when I remove the 'ref' keyword from the declaration as well as implementation, it builds fine. It just won't work properly because it is at that point passing a copy (isn't it?). What is going on here? Why will it build without error when I pass a copy, but fails when I pass by reference?
Any help would be greatly appreciated.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Which error message is your compiler giving?
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
See below...
The best overloaded method match for 'DataNamespace.ObjectBuilder.PopulateObject( ref DataNamespace.Base)' has some invalid arguments
'Argument '1': cannot convert from 'ref DataNamespace.Inherited' to 'ref DataNamespace.Base'
Thanks.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
You are infact passing by reference by default unless your base class is infact of a value-type!
"There are no stupid question's, just stupid people."
|
|
|
|
|
I went ahead and tried to run my app without the ref parameter and it worked--which led me to the same conclusion. I looked back at my Programming C# book (Oreilly) and sure enough, the example where he is using this is with value types. Oy!! People who think that C# and Java are the same are smoking crack. I like C# better because you can pass a value type by reference if you want to(in java you have to use the Integer, Double, etc. classes to do so). Thanks for your help.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
There was an obscure white paper I ran across once on the MSDN site which discussed the use of ByVal vs. Ref in application of VB.NET vs. C#.NET.
It basically stated that C#, by default, passes parameters as ref. So if you specify MyMethod(ref someParameter) what you are doing is passing a pointer to the pointer for the parameter. This could explain the illegal reference compile error if you are using the parameter as a parameter pointing to a data area within the caller, rather than a pointer pointing back to a pointer which points to the data area within the caller. gives me a headache just describing it.
---------------------------------------------
Once I thought I was wrong but I was happy to discover that was a mistake.
Condor
|
|
|
|
|
I know what you mean about a headache. It's not so bad once you get used to it, I suppose, but I'm used to C++ and trying to make the transition to C#. Probably a few more headaches along the way. I guess the rule of thumb with C# is if you think it's complicated, you're probably just making it so. Thanks for your help. I appreciate it.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Could be
It's one of the reasons why C++.NET could be considered superior (despite the rather hap-hazard managed extensions syntax) -- it forces you to box and unbox objects yourself, and think about whether they're value or reference types, and access them accordingly.
--
Paul
"I need the secure packaging of Jockeys. My boys need a house!"
- Kramer, in "The Chinese Woman" episode of Seinfeld
MS Messenger: paul@oobaloo.co.uk
Sonork: 100.22446
|
|
|
|
|
I have a float number like 32134(its size of file in bite).I want to divide it by 1000.So I do this:
f=12342;
f2=f/1000
I want to get 12.342 but it gives me 12. How can I get 12.342?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|