|
I'm using C#, .net2.0 framework and DB2 as my database.
I need to validate a database(DB2) query which is given by the user in the textbox. Please note that I just need to validate not to execute the query(text in textbox). I dont want any third party software and I want to do in .net2.0, ASP.net, C#, DB2
Please share your ideas and solution.
|
|
|
|
|
if you're using any kind of a dataSet u can create a shallow copy of it
and without "Thouching" the original Exe the Qurey for test only
use the try and catch finlly
Have Fun
Never forget it
|
|
|
|
|
thanks for your reply..
Could you please tell me how to do in .net2.0 with c#. If you provide steps or code is very helpfull for me..
Thanks in advance
|
|
|
|
|
Does db2 have the query parse facility like sql server? This allows you to parse the sql without executing. If so then you should be able to wrap it up in a try/catch and display any problems.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
thanks for your reply..
I'm not aware of sql parser in .net.. Could you please tell me how can i get it so that I can test the same with DB2 also..
Thanks in advance
|
|
|
|
|
The parser is not a .net feature, it's a sql server feature - SET NOEXEC ON. By doing this, when you execute your sql it simply parses but does not execute. I don't know if db2 has a similar feature?
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Does anyone know how I can encode a string to a CP865 encoded text, (not for example Unicode or UTF8).
What I am trying to do is to transfer a string content as an txt file with CP865 encodeing.
Response.ClearContent();
Response.AddHeader("Content-disposition", "Attachment;filename=Myfile.txt");
Response.ContentType = "text/plain";
Response.Write("This text shall have de Norwegian charset of the CP865 encoder");
Response.End();
Thanks
Thomas
|
|
|
|
|
You can convert to a specific codepage using the Encoder class:
byte[] bytes = Encoding.GetEncoding(865).GetBytes("This text shall have de Norwegian charset of the CP865 encoder");
You may also need to specify the encoding in your response header.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks, it worked great
Here's a example of my final solution, if anyone else ever needs it.
int chunkSize = 10000;
MemoryStream ms = null;
int dataLeft = 0;
try
{
Response.ClearContent();
Response.AddHeader("Content-disposition", "Attachment;filename=Myfile.txt");
Response.ContentType = "text/plain";
byte[] bytes = System.Text.Encoding.GetEncoding(865).GetBytes("This text shall have de Norwegian charset of the CP865 encoder");
dataLeft = bytes.Length;
ms = new MemoryStream(bytes);
while (dataLeft > 0 && Response.IsClientConnected)
{
byte[] currentChunk = new byte[chunkSize];
int currentChunkSize = ms.Read(currentChunk, 0, chunkSize);
Response.BinaryWrite(currentChunk);
dataLeft -= currentChunkSize;
currentChunk = null;
}
Response.End();
}
catch{}
finally
{
if (ms != null) ms.Close();
ms = null;
}
|
|
|
|
|
I'm trying to create a class that will dynamically load an assembly that will
hold a several definitions for structs (used as an interface to an existing application).
My class will then display those structs as strings - display the interface.
I need to load it dynamically since there are several versions of the same interface.
Thx.
|
|
|
|
|
Thats nice. What is the problem you are experiencing?
|
|
|
|
|
How do i do that ?
I know how to display the struct layout.
I know how to load dynamically the assembly.
Let me try and explain my problem:
lets say that i have a class A which can display type S as a string.
S is defined in class B.
I have to reference B or else i get a compilation problem.
but, since B has two versions (1 and 2) i want to load it dynamically.
how do i do that ?
|
|
|
|
|
Nir sheffi wrote: how do i do that ?
Your problem is not very specific. Maybe you need to rethink the design and focus on smaller problem areas.
|
|
|
|
|
but this is my problem !
i want to display a struct that changes between versions of assemblies.
|
|
|
|
|
Nir sheffi wrote: but this is my problem !
i want to display a struct that changes between versions of assemblies.
So what is the problem?
- Does it not load?
- Can you not differenciate between 2 versions of the same type?
- Do you get an exception when you do something?
- Anything else?
|
|
|
|
|
class A
{
void print(B b){....}; // prints type B
}
struct B (ver 1.0)
{
int x;
}
struct B (ver 2.0)
{
int x;
int y;
}
if A does not ref. directly to assembly that holds B we can not compile since A does not know B.
but i want to load B dynamically, so i do not want to ref. B during compilation.
that is my problem.
|
|
|
|
|
Hi everyone!!!
Is there anyone who knows how to retrive photos in the active directory using c#?
|
|
|
|
|
u Can Start Here in CodeProject
[^]
Have Fun
Never forget it
|
|
|
|
|
Hello,
I use the smtp and the System.Web.Mail namespace to send mail to Hotmail and Yahoo servers but I receive a failure message int Inetpub\mailroot\Badmail folder from hotmail server But I don't know why.
Thanks.
Dad
|
|
|
|
|
You have to have a hotmail account. You need to ask hotmail for their correct smtp settings in order to use their servers to send mail. If you have an account, and you think you have the correct settings, you should try asking in the hotmail forums, or sending an email to their support team.
Simon
|
|
|
|
|
Hello, I want to show two date value(starting date, end date) on top of my Crystal report
like this( From: 07-07-08 to To: 08-07-08). I select these two date in another form. Now how can I send this two parameter in my crystal report and print on top left of my report?
Can any 1 help plz??
|
|
|
|
|
Hi All,
I have a text box i dont want to user eneters here anything apart from character..
so is there any property exist here to validate automatically...
or i have to do it on textchange event ...
vikas da
|
|
|
|
|
No, for a normal text box you have to use an event to filter it. You could use the text changed event, or you could use the key press events and filter out any keys you don't want to accept. (This wouldn't stop them pasting into the text box though, so you should probably validate the whole block of text when the dialog was confirmed too.) Don't forget to not block the backspace/delete/arrow keys if you do this.
Simon
|
|
|
|
|
Thank alot for your reply.. i am trying the same now what you have been suggested....
vikas da
|
|
|
|
|
Use Validating event to validate the contents and cancel the event if required. This event will be fired when user moves focus out of the textbox, even pressing the ok button would trigger this event.
So, use this event to check if the text of the textbox is ok or not.
Nirandas,
a developer from India.
http://www.nirandas.com
|
|
|
|