|
As BobJanova said, this kind of code leaves you wide open to SQL injection attacks...
You might want to take a look at http://bobby-tables.com/[^] (Yes, it's funny, but it's also important)
|
|
|
|
|
The AccountNo field has a type of double in your database, which cannot be used with the 'like' operator. There are some solutions to this problem.
1. Change the type of AccountNo to text.
-or-
2. If you really want to use double for AccountNo, convert it to text in the query so that you can use the 'like' operator. The function to do the conversion may be different from one database engine to another. For example, in MySql, the function is 'cast', so something like this can be used:
string strFilterAccount = "cast(Accountno as char) like '" + Convert.ToDouble(txtAccount.Text) + "%'";
Considering that in many occasions an account number can really have letters and other non-digit characters in it, I think solution 1 may be better for you. (My water bill account number has letters and dashes embedded in it, for example)
SQL injection is a real issue here.
|
|
|
|
|
Thanks ,
apparently , There No solution for AccountNo , Unless I Change the DataType to Text .
But , if I define AccountNo to a Numeric DataType , Really , There is no solution for it.
By the Way wat is the equel of the "Cast" (in MySql ) for Sql . if we Use Cast , we get this Error !
The expression contains undefined function call cast().
Thanks a Lot !
|
|
|
|
|
If you are using Microsoft Access, the function to use is str(), like so:
string strFilterAccount = "str(Accountno) like '" + Convert.ToDouble(txtAccount.Text) + "%'";
SQL Server recognizes the 'cast' function. Please tell us what system you are using.
|
|
|
|
|
my DataBase is MsAccess , in spite of this , i get this Error !
The expression contains undefined function call str().
|
|
|
|
|
Sorry about the confusion. I was thinking that you were using a command object. Instead, you were using a DataTable. In this case, the function to use is 'Convert', like so:
string strFilterAccount = "CONVERT(AccountNo, 'System.String') like '" + Convert.ToDouble(txtAccount.Text) + "%'";
Hope this solves your problem.
|
|
|
|
|
how to transfer file from computer to terminal (windows-mobile) Through FTP
thanks in advance
|
|
|
|
|
|
I developed one website for my product.So now i would like to add some indian payment gateway API for the selling of my product through CC/Debit Card/Netbanking system.could anyone plz assist me for making that integration in to my site or please refer me some links on the same...
Thanks in Advance..
Srikanth P
|
|
|
|
|
You will probably need to contact the site that provides the gateway in the first instance.
|
|
|
|
|
|
hi
i transfer file from A to B Through WebService
after the was transfer i need to read his size.
i know how to do it, but when i try to read the file size i get:
The process cannot access the file XXX.XXX because it is being used by another process
what i can do ?
thanks in advance
|
|
|
|
|
Without knowing how your code works, we can only guess at the methods you used.
However, this kind of error normally comes up because the objects you created to access and copy the file have not been properly released, and are waiting for the Garbage Collector to come in and free them. The file will remain in use until that happens.
Look at your file transfer code, and call Dispose on all your objects rather than just letting them go out of scope.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Assuming you've copied the file, are you sure it's being copied synchronously and the operation completed?
If you're using some sort of stream writer to write the data into the new file, you need to make sure the stream has been flushed/closed/disposed.
As for disposal, the same goes for any other instances you've created that implement IDisposable. If you can (if they're not used further down the line), make sure that they are disposed (with a using statement or calling the Dispose method).
|
|
|
|
|
Did you mean to post that to me?
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Of course he did... you obviously need the help :P
|
|
|
|
|
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I have a C#.net winform project which uses few libraries which are also created by me. Now I am creating a COM wrapper and want to use the same libraries from an excel file through VBA. But I do not want the excel to create a new instance of the libraries. I need to use the same instance of the libraries which are loaded by the winform prject. Please suggest a way.
Thanks in advance.
|
|
|
|
|
When you create a COM Callable Wrapper (CCW), the mscorlib acts as the COM Server. The .NET runtime creates exactly one CCW for a managed object, regardless of the number of COM clients requesting it. Multiple COM clients can hold a reference to the CCW, which in turn, holds a single reference to the underlying managed object.
|
|
|
|
|
Agreed. But the Winform application does not use the libraries through COM server.
WinForm App
|- Library1.dll
|- Library2.dll
.
Excel
|-ComWrapper
|-Library1.dll
|-Library2.dll
I have tried to explain the current situation digramatically. In the above case two instances of Library1.dll and library2.dll will be created as they are called from different processes. I need to have just one instance of library1.dll and library2.dll in the memory.
|
|
|
|
|
Looks like an outproc COM server. That is your programs would communicate with a .exe instead of loading a .dll.
|
|
|
|
|
><<a href=""></a>[<a href="" target="_blank"></a>]
<small></small>
|
|
|
|
|
You might want to edit your question, and look at the text: it is showing as:
><<a href=""></a>[<a href="" target="_blank"></a>]
<small></small>
Which is not particularly helpful...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
sujtha wrote:
Is there any open source library C#/C++/C which will give me the delta changes of file (it can be any type)?
Which OS are you targeting? There's a few possibilities getting .Net/rsync to play together.
GitHub has a few rsync APIs built in/for C#:
https://github.com/MatthewSteeples/rsync.net[^] (uses native System.IO)
https://github.com/kolosy/rsync.net[^] (uses pinvoke for filesystem calls)
You could also use System.Diagnostics.Process to invoke rsync and control its process from within your application. You can trap its i/o streams for analysis to get your results.
If you're looking for a C/C++ API, you could check rsync's site to see what's available, but it's going to require a Linux/Unix environment to compile and run. The Windows rsync fork comes packaged with some cygwin DLLs to meet this requirement.
|
|
|
|
|
Hello.
I have these 2 small functions that work together to decrypt a small amount of data, that is also of fixed length, a byte array of length 15;
Does anyone know if it could be re-written for c#?
I have tried a few things but to no avail, for example, I do not know what memset() does, so do not know what to do in place within c#.
I do not want to use some large crypto library, and the reason for this small function is so that the encrypted data is the exact same length of the original data, 15 bytes.
So, here is the code....and thank you.
void DecryptInstID(unsigned char *InstID)
{
unsigned char *Left, *Right;
unsigned char Aux[8];
int i, k;
Left = InstID;
Right = InstID + 8;
for (i = 0; i < 4; i++)
{
KeyedHash(Left, Aux);
for (k = 0; k < 8; k++)
Aux[k] ^= Right[k];
memcpy(Right, Left, 8);
memcpy(Left, Aux, 8);
}
}
void KeyedHash(unsigned char *Data, unsigned char *Result)
{
SHA_CTX Context;
unsigned char Digest[20];
static unsigned char Key[4] =
{
};
SHA1_Init(&Context);
SHA1_Update(&Context, Data, 8);
SHA1_Update(&Context, Key, 4);
SHA1_Final(Digest, &Context);
memcpy(Result, Digest, 8);
}
Thank you!
Regards,
Stephen
|
|
|
|