Answer Questions
saddy incoding arabic language to hexa(important)
my application should send texts in arabic language through http protocol .. and as we know http does not support arabic language ... so I have to incode the texts into hexa ... how can I do that ... I have a source code but in VB.net can any one convert it to c#.net or can any one help me to write the incoding function .... this is the VB.net code Public Function ArabicHex( ByVal b() As Byte ) As String Dim s As String , h As String Dim i As Integer i = 0 s = "" While i <= UBound(b) h = Microsoft.VisualBasic.Right("00" & Hex(b(i)), 2) i = i + 1 h = Microsoft.VisualBasic.Right("00" & Hex(b(i)), 2) & h If h = "000D" Then h = "" ...Show All
Gareth Hunter FTP Error: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Hi, I am using a FTP client in my application. This FTP client is a freeware for .NET version1.1. It works fine for all files except two files. But these two files are required to FTP to a mainframe machine. I am able to FTP these two files in command prompt but getting error if I am trying to FTP through my c# application. These two files are giving two different errors mentioned below: 1. Index (zero based) must be greater than or equal to zero and less than the size of the argument list. 2. Input string was not in a correct format. But strangely, if I am trying to FTP these files to a Windows platform then it's getting FTPed successfully. I am also giving right SITE command for mainframe requirement. I am gettin ...Show All
Iago How can I create a packet using a Byte array??
please can anyone tell me how can I create a packet to insert it into a byte array using c# or any comments on how to create the structure to modify the values of the packet and convert it into a byte array THANKS BinaryFormatter.Serialize ...Show All
Raul Garcia - MS Access query to transpose table data
Hello, I have the following table structure in my database and would like to create a query or table that displays a single record for each country with the three different RatingsType1 across the top as column headings with the respective rating filled in. Something like this: Country Rating1 Rating2 Rating3 US AAA CCC Baa1 where Rating1, Rating2, Rating3 are one of the three types of ratings from the tblRatingsType1 table. Here's the table structure: tblCountry CountryID (PK autonum) CountryName tblCountryRating CountryRatingID (PK autonum) RatingType1ID (FK to tblRatingType1) Rating RatingDate tblRatingType1 RatingType1ID (PK au ...Show All
justsnafu Scope_identity equal to 0 from a stored proc as well
Here is my stored proc: InsertAccount Create PROCEDURE dbo.InsertAccount @AccRisAsse bit, @AccHldBll bit, @Acctaxexm bit AS insert into TblAccount(AccRisAsse,AccHldBll,Acctaxexm) values(@AccRisAsse,@AccHldBll,@Acctaxexm) return scope_identity() GO And here is the code in .Net to run the proc and get back the scope_identity: I delcare my sqlCommand sqlcmdInsNeAcc and connection from system.data.Sqlclient, I open my connection. all goes well then I do: sqlcmdInsNeAcc.type=commandtype.storedprocedure sqlcmdInsNeAcc.CommandText = "InsertAccount" pm = sqlcmdInsNeAcc.Parameters.Add(New SqlParameter("@AccountNumber", SqlDbType.BigInt)) pm.Direction = Para ...Show All
Murom Problem using FileSystem watcher
I have a filesystem watcher that monitors a file for any changes and raises an event. Now on this event, I'd like to call another function that reads this file and dumps the text to a control on the windows form. Here's a snippet of my code private : static void OnFileChanged( Object^ source, FileSystemEventArgs^ e ) { // Specify what is done when the file is modified, changed. readfile(e->FullPath); } .... .... void Perfmain::watchfile(System::String ^szPath, System::String ^tFile) { FileSystemWatcher^ watcher = gcnew FileSystemWatcher; watcher->Path = szPath; watcher->Filter = tFile; watcher->NotifyFilter = static_cast <NotifyFilters>(NotifyF ...Show All
Can-Ann How to invoke SOAP web service with C#
New to programming and need help on invoking a SOAP webservice in C#. I'm not getting a response from my Web Request code below. Is the WebRequest/WebReponse object suitable for invoking SOAP webservices Please let me know what modifications I need to make. Any help is appreciated. public DataSet GetMeter( string DEVICEID, string UID) { //create a web request object WebRequest request = WebRequest.Create(ConfigurationSettings.AppSettings["METERURL"]); //Add MeterPing URL to web.config request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; Stream ...Show All
yamobe How to wirte the Format code (use "K" instead of "000")?
I want use "K" instead of "000". eg change 1500 to 1.5K, Is there someone knows how to write the formate code in the " ###" float f = 1500; string formatedString = f.ToString(" ### "); If you want one decimal you can do it like this: float f = 1500; string formattedString = f.ToString("0,.0K"); The above gives at least one digit before and after the decimal point, e.g.: f = 1500 => 1.5K f = 500 => 0.5K f = 499 => 0.0K JocularJoe , That's what I want indeed. Thanks for your help again! Then you need to specify the number of places you want t ...Show All
Skill225 CLR and thread deadlocks
Hello, I'm hosting the CLR (.NET 2.0) in an unmanaged C++ app. The CLR is used for calling C# plugin functions through IDispatch. The C# plugins are COM visible classes and are created from the app main UI thread. They are mostly used for accessing the app through a COM primary interop assembly generated with TLBIMP.EXE. The interop between C# and the app is achieved through the default Microsoft COM wrappers. This is all working fine but I'm having a problem when the C# functions are called by the app from a worker thread. At this point the CLR attempts to interop with the app via the UI main thread which is causing a deadlock because that thread is locked while the worker thread is executing. From what I see in the call stack (b ...Show All
Paps SelectNode - create if does not exist
I am looking for a slick solution for this scenario: Input to a method should be an XmlDocument, an XPath expression and a string value. The inner text of the node found by the XPath expression should be set the the string value, if the node is not found it should be created first. The creation of the node is the biggest challenge here and I wonder if there is a good solution or functions which I am missing which can help me to accomplish this. Currently I put many restrictions on the XPath expression to make it work (no complicated queries: no back and forward, no search expressions). If the expression would be, e.g. /Root/Node1/Node2 I would split the expression by the slashes and navigate forward node by node and create one if it ...Show All
syhzaidi Determine if a path is a file or a directory
Hi all! What is the more efficient way to determine if a given path represents a file or a directory in the file system For example: C:\Test.txt -> The function must return a value indicating the path is a file. C:\Windows -> -> The function must return a value indicating the path is a directory. Thanks in advance, Marco. Thank you very much, you helped me a lot! Bye, Marco. Hi, I think that a better aproach is to use the System.IO. File .Exists and System.IO. Directory .Exists functions. Here is an example: string path = @"C:\Temp.txt" ; if (System.IO. Directory .Exists(path)) { Console .WriteLine( "The given path is a directory." ); } if (System.IO. File .Exist ...Show All
Frank S Does the .NET framework use true I/O completion ports for socket I/O?
Hi, I have seen conflicting information about this. Does the current .NET framework actually use real Windows completion ports for asynchronous socket I/O (I believe this would mean it would have to call the native CreateIoCompletionPort API in Kernel32.dll). Isn't this the highest performance, most scalable choice for servers _If_ .NET doesn't actually use it, what considerations made them decide not to use it Thanks, Alex Hi Amit, Well then I should be able to use Reflector to see somewhere in System.DLL a call to CreateIoCompletionPort. True But I don't. Likewise if I dump all the strings in System.DLL I also don't see "CreateIoCompletionPort" anywhere. Am I missing something Th ...Show All
muthuraja Problem sending and receiving data with synchronous sockets c#
Hey guys, Im trying to send and receive data between two applications using sockets. I can manage to establish a connection with no errors but when i try to send data I get the error "System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host". My code is as follows: Client 1 namespace SocketTestProgram { class Program { public static void Main() { Console .WriteLine( "***** Sockets Test *****\n" ); //Get local IP address IPAddress myIP = IPAddress .Any; // Set up IPEndPoint IPEndPoint clientEndPoint = new IPEndPoint ( IPAddress .Any, 4000); IPEndPoint serverEndPoint = new IPEndPoint (myIP, 40 ...Show All
stang4lyfe NotifyParentPropertyAttribute: how does it work
The documentation for NotifyParentPropertyAttribute says that setting it to 'true' " indicates that the parent property is notified when the value of the property that this attribute is applied to is modified. " Bravo !!! The only thing left out of such brilliantly clear documentation is the very minor explanation of HOW " the parent property is notified when the value of the property that this attribute is applied to is modified. " Perhaps someone can enlighten me on how I am supposed to know in the parent property, with this attribute set to true, of my control that a child property has been modified, and how I am supposed to know which child property has been modified. Thank you ! ...Show All
gurvinder_gill Why the difference between Access Query Configuration and Tableadapter Query Configuration Wizard
I have found that I can run a query using Access query builder works fine but the same query does not work in the "TableAdapter Query Configuration Wizard". Why is this Example: SELECT * from Rental_Agreement WHERE DateSerial(year(end_date), month(end_date) , day(end_date) - 5) = Date() This works in Acess 2003 but not in the "TableAdapter Query Configuration Wizard". Yes it was an Access table. The syntax was essentially the same as yours. You could also check the sandbox mode if the error is telling you that the function is unknown. It's stored in the Registry under the following key: \\HKEY_LOCAL_MACHINE\Software\Microsoft\Jet\4.0\engines\SandboxMode The va ...Show All
