|
Hi,
I am developing application in asp.net 2.0 using C#. My back end is sql server 2005. I also use microsoft enterprise library 2006.
My problem is:
First i pass three parameters to stored procedure from the application. After i increase one more parameter in both application as well as stored procedure, the application gives an error that parameter does not match with the stored procedures parameters.
after couple of hours when i restart the machine and again run the application it works fine with four parameters.
does sql server 2005 stores the parameters in cache??
if it does not keep it in cache then how come i get an error that values does not match the values in the stored procedure??
modified on Monday, April 28, 2008 10:30 AM
|
|
|
|
|
what is the equivalent of following C structure in c#
struct mystructure
{
int number;
char name[256];
};
Rajesh
|
|
|
|
|
Hi,
it depends on what you want it for. If it's just data being shared between two
pieces of C# code, then use:
struct myStructure {
int number;
string name;
}
and it will hold your data, whatever the length of the name string will be.
If on the other hand you want to share the data with code in another programming language,
or with a hardware device, then it will take more effort (e.g.with Marshaling attributes
or code) to match the requirements.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
actually i am writing some fields from webpages to file
using structure. then I read the file using same structure
in the c++ programme . in c++ no string data type so I cannot use string
in my structure
Rajesh
|
|
|
|
|
|
I am c# programmer and c++ site cannot change .it is already running and cannot change huge code there.
Rajesh
|
|
|
|
|
Fair enough then.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Three comments then:
so it is a binary file (because of the int) although probably most of the data is text?
I would make it all text then (hence use int.ToString and/or int.TryParse)
are you aware of character sizes? in C/C++ it could be 8-bit or 16-bit, on C# it will
be 16-bit.
Some people would recommend using XML for something like this. I'm still undecided.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
You can use a BinaryWriter to write the data to the file.
The .NET equivalent of a C++ char is a byte. If you have text to put in the file, you have to know what encoding to use to turn it into an array of bytes.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
structure mystructure
{
int number;
string name;
}
The default for those variables in C# will be private (I believe), you will have to create properties to expose the variables.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hello everyone,
For the default approach for a console application or Windows service written in C#, if there is an uncaught exception, the console application or the Windows service will terminate? Right?
thanks in advance,
George
|
|
|
|
|
Gee - how easy would this be to find out for yourself ?
Yeah, the exception will reach the top level, won't be caught and your app will report an error to the end user.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian,
I am just asking for others' experience. "report an error to the end user" and program will terminate, right?
regards,
George
|
|
|
|
|
yes, it will terminate, but it will do so in an ugly way. Any app I deploy has top level exception handlers that write an error log to the hard drive, and tell the user about it ( and often, email it to me ).
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian,
Your reply is clear.
regards,
George
|
|
|
|
|
Hello everyone,
We can refer and use another type in a C# DLL file, but can we refer and use another type in a C# EXE file (build as executable)?
thanks in advance,
George
|
|
|
|
|
I don't know if you can create a reference to an exe, did you try ?
I'd be inclined to factor the types needed by two exes out into a dll, in fact, that is exactly what I have done in the past.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi Christian,
What means "I'd be inclined to factor the types needed by two exes out into a dll"? Could you say in other words please? My English is not very good.
regards,
George
|
|
|
|
|
Exe 1 contains a class 'Fish'. You want exe 2 to use the Fish class. That's your question, right ?
I'd create fish.dll, which contains the fish class. Then, I'd reference that dll in BOTH my exes, in other words, the bits in exe 1 that you want to use in exe 2, I'd move to a dll and use that dll in both exes.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Thanks Christian,
Yes, this is my case. In my situation, it is previously designed as an EXE. I am wondering whether I can refer the types in EXE directly without rebuild and redeploy as DLL.
regards,
George
|
|
|
|
|
I am not sure, but I guess using reflection you can invoke methods from assemblies(dll/exe). Here is an article[^] talks about reflection. Hope it will help.
|
|
|
|
|
Thanks N a v a n e e t h,
What I mean is to add reference to types in EXE during compile time (just like what we did for a DLL assembly), I think reflection is using types in another EXE during runtime, right?
regards,
George
|
|
|
|
|
hi all,
im realy new in db programing.
i have a database file there is "mean table" and there is two fields short field and fullform field.
----------------------------------------------------
ID|SHORT| FULLFORM
----------------------------------------------------
1 | CPU | central proccesing unit
2 | RAM | random access memory
3 | HDD | Hard disk drive
----------------------------------------------------
my problem is this
i have a window with textbox1 and textbox2 and search button
when user type in textbox1(CPU) and press search button
in textbox2 need to display "central proccesing unit"
how to do please help
|
|
|
|
|
Buy a book on SQL and one on ADO.NET. This is really basic stuff.
Select FULLFORM from <insert table="" name="" here=""> where SHORT = 'CPU'
Write a stored proc for this or parameterise your query. NEVER build SQL with the raw input of text boxes.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: Select FULLFORM from where SHORT = 'CPU'
Select FULLFORM from [mean table] where SHORT = 'CPU'
|
|
|
|