Jump to content
Xtreme .Net Talk

TripleB

Avatar/Signature
  • Posts

    38
  • Joined

  • Last visited

Everything posted by TripleB

  1. What is the error that you get? Maybe try to step trough the code to see if he does the check correctly realized something, if you use wildcards that you have to you LIKE and not = in your SQL statement ... if I am not mistaking. Greetz,
  2. Hey, Can't you just do this. If the textbox is empty than the value to search is by default % (wildcard). Regards.
  3. This means that you are using an object that is not instanciated, do you have some code in the close event of the form? You just have to find where the error is thrown. From there on if you give the code I could give you some pointers, But the bottom line is that you are trying to use something that has not been instanciated (ex Form frmExample = new Form() ) Greetz
  4. Hi, It is not realy weird, it is an entire different error, it says that you are assigning something (your selecteditem) to something that is not compatible with that (your datarowview) It even suggests the answer (are you missing a cast). So your first problem is solved, but you are now facing another one. Greetz
  5. This is the code I used, nothing to fancy just using a timer to call the webservice every 8000, and according to the result of the parsing I call another webservice to send the message. #pragma once using namespace System; using namespace System::Collections; using namespace System::ServiceProcess; using namespace System::ComponentModel; using namespace System:: Diagnostics; using namespace GsoapSMS; using namespace MessagingSystem; using namespace System::Text; namespace CheckSMS { /// <summary> /// Summary for CheckSMSWinService /// </summary> /// /// WARNING: If you change the name of this class, you will need to change the /// 'Resource File Name' property for the managed resource compiler tool /// associated with all .resx files this class depends on. Otherwise, /// the designers will not be able to interact properly with localized /// resources associated with this form. public __gc class CheckSMSWinService : public System::ServiceProcess::ServiceBase { public: CheckSMSWinService() { InitializeComponent(); } /// <summary> /// Clean up any resources being used. /// </summary> void Dispose(bool disposing) { if (disposing && components) { components->Dispose(); } __super:: Dispose(disposing); } private: bool stopping; int loopsleep; //milliseconds Threading::Thread* servicethread; private: System::Timers::Timer * tmrCheck; sms *LocalSMS; protected: /// <summary> /// Set things in motion so your service can do its work. /// </summary> void OnStart(String* args[]) { Threading::ThreadStart* threadStart = new Threading::ThreadStart(this,mainLoop); servicethread = new Threading::Thread(threadStart); servicethread->Start(); } void mainLoop() { loopsleep = 10000; //milliseconds stopping = false; LocalSMS = new sms(); ArrayList *list = new ArrayList(); while (!stopping) { if(tmrCheck->Enabled == false) tmrCheck->Enabled = true; Threading::Thread::Sleep(loopsleep); } } void ParseMessage(SmsInfo* info) { if(info->Message->StartsWith("[u]")) { SyntraWebService *msging = new SyntraWebService(); StringBuilder *strBuild = new StringBuilder(); System::Object* list[] = msging->AllContacts(); for(int i=0;i<list->Count;i++) { strBuild->Append(list[i]->ToString()); if(i < list->Count -1) strBuild->Append(","); } LocalSMS->SMSSend(info->Number->ToString(),strBuild->ToString()); } } /// <summary> /// Stop this service. /// </summary> void OnStop() { stopping = true; } private: /// <summary> /// Required designer variable. /// </summary> System::ComponentModel::Container *components; /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> void InitializeComponent(void) { this->tmrCheck = new System::Timers::Timer(); (__try_cast<System::ComponentModel::ISupportInitialize * >(this->tmrCheck))->BeginInit(); // // tmrCheck // this->tmrCheck->Enabled = true; this->tmrCheck->Interval = 8000; this->tmrCheck->Elapsed += new System::Timers::ElapsedEventHandler(this, tmrCheck_Elapsed); // // CheckSMSWinService // this->CanPauseAndContinue = true; this->ServiceName = S"CheckSMS"; (__try_cast<System::ComponentModel::ISupportInitialize * >(this->tmrCheck))->EndInit(); } private: System::Void tmrCheck_Elapsed(System::Object * sender, System::Timers::ElapsedEventArgs * e) { SmsInfo* SmsRetval; do { if((SmsRetval = LocalSMS->SMSCheck())!= 0) { ParseMessage(SmsRetval); } }while(SmsRetval->NbrofSms > 0); } }; } greetz
  6. I had the same problem in the same situation, also tried to send sms through webservice, but this one was located on a linux server, I am going to look at my project to see how I've solved it, Greetz
  7. Yes it is possible, what exactly are you trying to do?
  8. Not quite sure about what you are trying to do, the code you provided doesn't make much sense. If you have filled your array with the names of the fields of your row, you can easily create all sorts of strings with that, just loop through the items of the arraylist, with a for each loop and append them to a stringbuilder object to the string that you desire. example in C#: 'Create the arraylist ArrayList FieldList = new ArrayList(); StringBuilder strQuery = new StringBuilder(); 'Add items to it FieldList.Add("Item1"); FieldList.Add("Item2"); FieldList.Add("Item3"); foreach string strItem in FieldList { strQuery.Append("This is the item: "); strQuery.Append(strItem); } MessageBox.Show(strQuery.ToString()); This will add item1..3 to the arraylist then append all these items to the stringbuilder object and show a messagebox showing the concatinated string. In this manner you can create everything you want, from sentenses to queries to whatever. Maybe this will help, but i would suggest to clarify you question so we can offer you a better explenation or solution. Greetz
  9. In my opinion you can't, if you read the msdn documentation you will see that the IDatareader interface meaning also the oledbdatareader and I quote: "Provides a means of reading one or more forward-only streams of result sets obtained by executing a command at a data source, and is implemented by .NET Framework data providers that access relational databases." So I think it is not possible to do so, I would recommend storing your query in a DATASET which gives you more options in that directions. Greetz
  10. the class you should use is System.IO.Directory The methods are GetLogicalDrives() retrieving all the disks GetDirectories() retrieving all directories GetFiles() retrieving all files They all return an array of strings containing the names of the items. with this information you can build what you want, using these Controls the treeview and the listview. This should get you started, If you still need some help please let me know Greetz
  11. You can use the colordialog Colordialog Greetz
  12. Ok, the reason my code was so slow was actually my own dumb fault, I opened and closed the connection everytime I added an record so seriously perfomance drop, aftering altering this method in first adding the sql string to an string array, and than executing them all in 1 open connection time was divided by 45 so i would say thats a reasonable improvement :). I can now add approx 250 records in 1,52 sec whats ok for me, i am still going to try an other approach with first writing it to csv and then import that file into excel, the writing of the csv takes only 0.25 sec so unless importing it in excel takes forever it might just be a bit faster I'll post my findings back here, Greetz
  13. Hello all, I have written a class that exports all the rows of a table in a dataset to an excel file, I use an oledb connection to do this. now it works no problem but I wonder if I can speed it up, this is where you specialist come in, this is my code this one creates the excel file and the first cells ( headers ) try { if(System.IO.File.Exists(System.IO.Path.GetFullPath(_FileName))) System.IO.File.Delete(System.IO.Path.GetFullPath(_FileName)); DT = _ds.Tables[0]; StringBuilder CreateTable = new StringBuilder("CREATE TABLE "); CreateTable.Append(_ds.DataSetName); CreateTable.Append(" ("); foreach(DataColumn col in DT.Columns) { CreateTable.Append(col.ColumnName); CreateTable.Append(" " + DBDataType(col.DataType,col.MaxLength) + ", "); } CreateTable.Replace(",",")",CreateTable.Length - 2,1); CreateTable.Append(";"); Console.WriteLine(CreateTable.ToString()); Console.WriteLine( BVQuery.Excel(_FileName).ExecuteNonQuery(CreateTable.ToString()) ); return true; } catch(OleDbException) { return false; } this inserts the records into the exsisting excel file. StringBuilder InsertString = new StringBuilder(); foreach(DataRow row in DT.Rows) { if(InsertString.Length > 0) InsertString.Remove(0,InsertString.Length); InsertString.Append("INSERT INTO "); InsertString.Append(_ds.DataSetName); InsertString.Append(" ("); foreach(DataColumn col in DT.Columns) { InsertString.Append(col.ColumnName + ","); } InsertString.Replace(",",")",InsertString.Length - 1,1); InsertString.Append(" VALUES ("); for(int i = 0;i<row.ItemArray.Length;i++) { InsertString.Append("'" + row.ItemArray.GetValue(i).ToString() + "',"); } InsertString.Replace(",",")",InsertString.Length -1,1); InsertString.Append(";"); Console.WriteLine(InsertString.ToString()); Console.WriteLine(BVQuery.Excel(_FileName).ExecuteNonQuery(InsertString.ToString())); } the BVQuery.excel.executenonquery just executes the sql string given on a oledb connection to the excel file All comment apreciated Greetz to you all
  14. variable declaration Where have you declared your variable, because if you declare it localy inside the constructor or function if you reach the end of that block of code the variable goes out of scope ... If i am not mistaking
  15. Hey all, Does anyone have a clue on this one... When I serialize my object to a binary file, and read it back (without closing the app) everything works fine, but when I serialize my object, close the app, and then try to deserialize the file back to the object I allways get an invalid cast exception... Is this security related??? Thx in advance,
  16. Hey all, I need to write a simple programm that can check network resources now my question is can i use the win32 api like on a windows environment or is there a special api for pocket pc that can supply this? Greetz
  17. Hey guys thx for your replies, i fixed my problem by replacing the definition of the http channel by ref="http" and that worked, and if i added the runtime.remoting dll to the GAC then the the first solution also worked greetz
  18. Hey all, Having bit of a problem with a remoting config file I am just learning about remoting when I hardcode it everthing works fine but when I use a config file I get an error about missing a file System.Runtime.Remoting Not sure what is meant by this because I added a refference to the dll and again when i set the channel up in my code it works fine here is my config file <configuration> <system.runtime.remoting> <application name="ListServer"> <service> <wellknown mode="Singleton" type="ListServer.CompanyList,ListServer" objectUri="CompanyList"/>; </service> <channels> <channel type="System.Runtime.Remoting.Channels.Http.HttpChannel, System.Runtime.Remoting" port="8080"/> </channels> </application> <debug loadTypes="true"/> </system.runtime.remoting> </configuration> Do I have a Typo somewhere because i looked it over severall times and can't find anything... Thx in advance
  19. Does annoyone know why this happens when I run my application this is created copyexplorer.vshost.exe it takes a lot of memory en when i end the process it just comes back taking more memory... the application kind off a backup application copying a lot of files most of the time... why is this file created and does it do ?? thx in advance
  20. Hey, do you try to use the extract method from another form or something because if you do you don't have acces to it, if not could you give some code so that we can see what you are trying to do? greetz
  21. User Account With Password Hey, it could be that the account you are trying to acces is made personal so you don't have rights to read or write to that folder. you can change the permissions on that account so that you can acces them... Greetz
  22. How you would do it manualy step by step: first you have te make sure you can acces the security tab in the properties dialog(xp pro: turn of simple file sharing, xp home: boot in save mode) there you choose advanced, there you choose owner, then you can choose wich user to transfer the ownership to, you can choose between the administrators group and the user account you are logged on with, there you choose your account, and make sure you select the replace owner of subcontainers and objects then you confirm this let windows do its work changing the permissions. And you have granted yourself access to the other accounts files.... now my problem is that I want this to be automated, so that I can let the app backup all the nessesary files without interaction of the user... If there is a way to do this in means of imersonating the system and or supplying the accounts username and password this would be fine for me as this is no problem but the way I have mentioned above only can impersonate excisting users in that environment, and the account's files are assigned to an unknown user which is identified just by an SID (can I use this in any way??) OK this is a lot I know,... but hopefully it clarifies (how do you spell this :-\ ) the problem a bit THX in advance Greetz
  23. Ok, I have allready considered that, I even tried it, but the function to impersonate a user needs a password, and the System account doesn't have one or am i mistaking? Or is there another way to act as the system account? Thx in advance Greetz
×
×
  • Create New...