Answer Questions
v-rider Talk to SQL database from C#
Hi everyone, I have a database file that I want to access from C#. I want to be able to read from it, write to it and generally do SQLy things with it. I have used SQL before, so I am not to worried about the actual language bit. What I can't get to work is the interface between C# and my file. My code so far is: using System.Data.SqlClient; private void Connect_Click( object sender, EventArgs e) { string connect = "connection timeout=45" + ";" + "Data Source=|DataDirectory|\\CsTestDataBase.mdb" ; SqlConnection myConnection = new SqlConnection (connect); myConnection.Open(); SqlCommand myCommand = new SqlCommand ( "INSERT INTO Info (MyDate, FileNa ...Show All
hungryghost Generics class and abstract class
Hi, I'm currently converting a project to use generic classes. In the situation described below, I don't know whether I should keep an abstract class or not. Before using generic types, there're an AbstractElement class, and two derived classes - Element16 and Element32. There's a DataList class, which has an ArrayList to store AbstractElement object. Now I use a generic type Element<T>, where T can be uint or ushort, to replace Element16 and Element32. But I don't know how to modify the DataList class to use Element<T>. I don't want to make DataList a generic type, since the users of DataList don't know whether the Element objects in DataList are Element<ushort> or Element<uint>. Should I keep the Abstract ...Show All
ZopoStyle DllImport call using a struct as param throwing exception
Hello, I'm trying to call a C DLL, and having some issues building a struct that will pass through successfully. Here's an abbreviated version of the definitions in the C .h file: typedef struct { /* inputs */ char hist[ 4 ]; char site[ 5 ]; char behav; char grade; char age[3]; char size[3]; char ext[3]; /* display outputs */ char t[12]; char tdescr[4]; char n[12]; char ndescr[4]; char m[12]; char mdescr[4]; /* error messages */ unsigned long error; char messages[ 2000 ]; } datacard; #define CSTAGE_API __declspec(dllimport) CSTAGE_API int CStage_calculate( datacard *dc ); On the C# side, this is what I have so far: &nb ...Show All
m_umair_85 using windows logon name
I want to use windows xp logon name(user name in active directory) in my c# code (web app). for example if the user who opened my web site is ABC(this is the logon name to windows) then abc.aspx will be opened, if the user is TOM the def.aspx will be opened. How can i do this Please help me. Not sure, I've never used it but I am guessing since it is a servervariable, that the AUTH_USER would be user name logged on to the server, whereas User.Identity is windows user name. The user logged onto the server could have an anonymous connection thus I think it would return the user name used for anonymous connections in IIS. glad to help ;) Does this differ from Request.ServerVariables["AUTH_USER" ...Show All
ab2304 Element 'ProjectProperty' is not a known element.
I have this problem: Element 'ProjectProperty' is not a known element. This can occur if there is a compilation error in the Web site. Can anybody help me! Thank's! frederikm wrote: hi i was under the impression that you are developping some extension for sharepoint 2007... otherwise, why would you be using the sharepoint dll I'm making a site whith the sharepoint 2007, but i didn't antherstand what is the moss frederikm wrote: Hi, where did you get this error on you local machine or in the sharepoint site did you add a reference to the sharepoint dll in you local project This error is in my ...Show All
Batikit Communicating with my USB MIDI Keyboard..
I'm trying to write a C# program to communicate with my MIDI controller keyboard which uses a USB connection and shows up as a USB Audio Device. I'm wondering how exactly I can communicate with my keyboard, since I'm going to write a program that will play the appropriate note, and run in the background, so I don't need any other programs running just to listen to what I'm playing. I've been unable to find any information on how to access my USB device, and though there are some C# USB communication libraries, I havent exactly figured out how to work them, considering usblib-win32 has no documentation of it's own, and usblib's own documentation os so minimalistic to the point of making little to no sence to someone who doesn't have ...Show All
kawano1h C# Date Time Help
Ok I am writing this program to log me into WoW at a sertain time set by the user, but right now it won't work. My question is how can I get it to continually check against the current time and then fire the process when they are equal right now the way it is I just get a Not responding error in Task manager with it. [code] using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; /* NoWait V1.0.0 by TRTwiggy * * Date: October 22, 2006 * * Author: TRTwiggy AKA Tyler Reid * * Description: This program was written for two reasons. The first is to help * develop my coding skills. The second is that I got so damn tired of get ...Show All
pessi COM : Interface from c# to c++ problem with IntPtr type
Hi all, I have a C++ application that load C# applets. A method use an IntPtr parameter because I want to be 32/64-bit compatible. The problem is in the .tlh file generated. This parameter is a long and not an INT_PTR and I don't know why Here is some code that may help you. In C# project. public interface IDlgCriteresRecherche { IntPtr HandleEditeurParent { get; set;} } public class AScDlgCriteresRecherche : System.Windows.Forms.Form, IDlgCriteresRecherche { #region IDlgCriteresRecherche Members private IntPtr nHandleEditeurParent = (IntPtr)0; public IntPtr HandleEditeurParent { get{ return nHandleEditeurParent; } set{ nHandleEditeurParent = value; } } #endregion } In the .tlh generated struct __dec ...Show All
takkyangel Quick Find in visual studio 2005 disappeared
I used to be able to hit control key and F key, it pops up the Quick Find window, now this does not work anymore. All the options listed under pulldown menu Edit and Find and Replace do not display any window. it just did nothing. could anyone please let me know how to get those functions back. I personally do not believe it's linked to the dual monitor setup. I'm also lucky enough to have dual monitors, and it just sometimes happens. :< The quickest way to test/fix this is to use the windows keystrokes to open the control menu (the file handle on the top left of the window, or should I say the minus sign, yup, it's supposed to represent a file handle on a physical file cabinet :>) with ...Show All
Newt.Net Schedule Event
Hi again... I need to run this every day at the same time or once a week on a predefined day and hour. How's it done Been through allot of research but couldn't make it work This is the event i need to schedule private void BackUp() { Cursor = Cursors .WaitCursor; SQLDMO. _SQLServer srv = new SQLDMO. SQLServerClass (); srv.Connect(server, username, password); SQLDMO. Backup bak = new SQLDMO. BackupClass (); bak.Devices = bak.Files; bak.Files = BackupFolder + database + ".bak" ; bak.Database = database; bak.SQLBackup(srv); this .Cursor = Cursors .Default; } catch ( Exception err) { this .Cursor = Cursors .Default; MessageBox .Show(err.Message, &quo ...Show All
IMBack Interop.SQLDMO.dll Problem
hi everybody, i am working on register sqldmo dll but not registered on 2003 server. error= C:\Document and Settings\Administrator\......\Interop.SQLDMO.dl was loaded,but the DllRegisterServer entry point was not found. This file can not be registered. What can i do thx "and was a error". What was the exact error message Setting it from Any CPU to x86 did the trick. Just in case someone else is having this same issue the Build tab is the Compile tab and from there you have to click the Advanced Compile Options button and then you can change the Platform target. But all that matters to me is that it did the trick. Thanks for your reply nobugz..... 0x80040154 ...Show All
kaushikn1 How parallel programming is achieved in C#
I am doing a project using C#.NET on "Performance evaluation of sequential and parallel execution of various sorting algorithms". I want to know whether parallel programming is possible in C# or not .If possible plzzz tell me how it can be What technique will be used to do so Correct me if I'm wrong, but I think Swati might be refering to multi-threading ("... parallel execution of various sorting algorithms") , which is definately possible in C#, and actually quite easy too. The System.Threading namespace will contain just about every thing you need to do simple parrel execution of algorithrms (assuming the processor the program is run on supports it). Try using the System.Threading.Thread class; I do not ...Show All
Rapier685 Can I see settings, and add an exception (a port number) to the windows firewall from C#?
Can I see settings, and add an exception (a port number) to the windows firewall from C# To control Windows Xp Firewall Pragmatically use Windows Firewall API for more info look at i think you will find your anwer in this article look at the code also Windows XP SP2 Firewall Controller Windows Firewall Reference ...Show All
13thGhost SqlConnection.Open() OutOfRangeException - Need Help!
Hello! I am trying to open a connection between my programe and a mySQL server with the SqlConnection.Open() method. My connection string looks like this: " Data Source=tcp:myservername, 3306;User ID=****; Pwd=******;Pooling=false;" As soon as I call the SqlConnection.Open() command I get the following error message: "None-negative value needed. Parameter Name: count" (I have translated it from German into English so it can vary from the original message) I have no idea why this happens and as you see I have already disabled Pooling but no chance. Has anyone got any idea Thanks in advance! veryxRV It is real, it's just translated from German, but the s ...Show All
Tampa Magnus dataset partial acceptchanges
Hi, i have attached a dataset to a updatable datagrid. now i add some rows to the dataset , some updates in rows and deletions of some rows (rows which are deleted or updated can be new one or the old one). Now before calling acceptchanges() on dataset, i need to rollback only the deletes which are been made leaving the updates and addition of rows intact What is the best way to attack this problem. Best Regards You have to enumerate all the rows in the all the tables of your DataSet . For each row you can use the RowState property to determine if the row was deleted. If it was you can undo the change by calling RejectChanges on the row. foreach (DataTable dt in ds.Tables) { foreach(Da ...Show All
