Kosher Coder's Q&A profile
Visual C# Closing a Web Form using Visual C#
I am doing an assignment for a class where I create a web form and one of the buttons in it has to close the form. I am using Visual Studio .NET 2003 and Visual C# to do this. I can't find any method or property on how to do this. I tried this.Close() and it came back with an error. Does anyone have any code sample or know the method on how to have a button close the form This was the error and the part of the code where it happened: private void btnExit_Click( object sender, System.EventArgs e) { this .Close(); } c:\inetpub\wwwroot\HMWK1\Diner.aspx.cs(74): 'HMWK1.WebForm1' does not cont ...Show All
Visual C# Changing the return type of a check box to 0 and 1 from true and false
Hi, Is there any way I can change the value returned from a checkbox to 0 and 1 from true and false, the reason being that I want to pass a a value of 1 or 0 to database (bit datatype) Many thanks If you use paramitrimized queries you don't have to whory about this. Here is a sample of using paramitrimized queries: bool value = true ; const string query = "INSERT INTO [Table1]( BitField1 ) VALUES( @BitField1 )"; SqlParameter pBitField = new SqlParameter("@BitField1", SqlDbType.Bit); pBitField = value; // Create connection and open it. SqlConnection dbConn = new ...Show All
.NET Development OnThreadException
Hello All, I use BackGroudWorker in a Windows forms application I have a question : In the RunWorkerCompleted event handler, I throw a new exception of type "RefreshException" as follows: private void refreshWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Error != null) { if (!mIgnoreException) { throw e.Error; } else { System.Diagnostics.Debug.Write("AutoRefreshException:" + e.Error.Message); throw new AutoRefreshException(); } } I have a centralized event handling, I handle ...Show All
.NET Development Change password in Active Directory
I am trying to change the Active Directory password using C#. However, it seems to me it does not really works. I wonder what is wrong with my code. Hope somene can help me with this and thanks in advance. Below is my code : try { string dcDNS = "mypsptestdev"; //use this if you want to supply a server name DirectoryEntry userEntry = null; string currentUserName = (((string)Context.User.Identity.Name).Split('\\')) [1]; DirectoryEntry rootDSE = new DirectoryEntry(String.Format("LDAP://{0}/rootDSE", dcDNS), "_aduser", "TESTsql@dm1n", AuthenticationTypes.Secure); string rootDN = rootDSE.Properties[" ...Show All
SQL Server CLR trigger in another schema
Hi, I'm trying to write a clr trigger. I have created Myschema schema under schemas folder and Table1 under this schema (i.e.: Myschema.Table1). I created a clr trigger and tagged it with the Sqltrigger attribute as shown here: [ SqlTrigger (Name = "Trigger1" , Target = " Myschema.Table1 " , Event = "FOR INSERT" )] When I try to deploy my assembly from VS 2005 I got the following error: Cannot find the object "Myschema.Table1" because it does not exist or you do not have permissions If I move Table1 in the dbo schema the assembly is deployed succesfully If I add the assembly from the Assembl ...Show All
Software Development for Windows Vista Problems with state persistence and timer services
Hi, I've experimented with adding the SQL state, timer and tracking services to the Lab1 sample step 4 (the expense report approval workflow). The tracking service works fine, but it seems that the state and timer services get the engine stuck on the ListenForManagerApproval activity. If I disable the state and timer services the workflow unfolds as expected. I use the (really cool) Workflow Monitor sample to view the results, and the progress is evident every time: With the state and/or timer service enabled, the flow gets stuck on ListenForManagerApproval and then after a while the workflow gets the status "aborted". Any ideas why ...Show All
SQL Server Merge Replication with SQL Mobile Server 2005 / SQL Server 2005
I am using Merge Replication to Synchronize a database on a mobile PDA. I create an empty table 1st using; "engine.CreateDatabase()" then sync with ; "replicator.Synchronize() " It works great the 1st sync, but subsequent calls to "replicator.Synchronize() " dont download new table changes at the server level to the remote PDA. I have found by calling ; "replicator.ReinitializeSubscription(True)" I can get new updates downloaded to the handheld, but it is very flaky / glitchy when using this call and hangs / freezes / or doesn't work all the time, every second attempt seems to work.... My questions is... 1) after initial synchro ...Show All
.NET Development How to create master page in asp.net
While creating Header and footer option in asp.net application which is a better option using DHTML Code or User Control And Why I got an answer thru this web site that should create a master page how to do that Hi, Asp.Net related questions should be posted in forums.asp.net . You would likely find an answer there. cheers, Paul June A. Domag ...Show All
Visual Studio 2008 (Pre-release) C# 3.0 Feature Suggestion - symbols
I was playing around with ruby the other day and was reminded of the ":" symbol as in "abc".send(:length), although ruby doesn't care if the :length symbol actually exists on the target, it gave me the idea that we could really use a language feature that would have compile time checking for class members to be used as an alternative to passing around field/property names as strings that are later used in reflection apis, O/R mappers, rule engines, WPF, etc. Reflection can be useful way to remove clutter from the domain model and make the code simpler it can also introduce hard to find bugs (if your tests aren't good enou ...Show All
Smart Device Development Show Application info in HomeScreen
Hi all, I have an simple windows mobile application for Windows 2005. the application contains certain data of the user. i would like to show some of these data in the Home Screen as well. how is it possible. regards, rnv You should only post the same issue in one of the forums. When you say Windows 2005 I guess you mean VS2005 Here is a good start: http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnppcgen/html/todayscrn.asp You could also search for Today screen in these forums and you will find plenty of information: http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=128780&SiteID=1 http:/ ...Show All
Windows Forms How to deploy data files with ClickOnce
Hi, After playing around with ClickOnce for a couple of days I'm fighting off the urge to go back to the MSI. Reason, getting my data files on to the client machine. The Application Files button in the VS.Net Properties Page>Publish section refuses to recognise that I have some non-dll/exe plain vanilla data, text and help files I need to publish with my app. I have read all you need to do is add such files to the solution but despite doing this they stubbornly refuse to appear in the manifest. I tried adding them using mageUI and it appeared to save them as Data files but they just don't turn up on deployment ( which works beautiful ...Show All
Visual C++ need english
Getting ready to work on another lab for school and I'm having trouble understanding the lab. This is the program they want me to write: Write a program that declares two twenty-element, one-dimensional integer arrays. Your program should fill these arrays with random numbers by calling a function called Fill_It. You will call Fill_It twice, once for each array, and ask the user to enter two different seed values. Fill_It needs to have a seed value, and low and high range values, and all three integers should be passed to it along with the array. Fill_It will use the seed for srand and then fill the arrays with values between the low and hig ...Show All
SQL Server Locks - Isolation Levels
Good morning, I am trying to get my head around locking (row, table) and Isolation Levels. We have written a large .NET/SQL application and one day last week we had about two dozen people in our company do some semi "stress/load" testing of the app. On quite a few occassions, a few of the users would receive the following error: "Transaction (Process ID xx) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction." We are handling this on two fronts, the app and the database. The error handling in the app is being modified to capture this specific ...Show All
SQL Server MSDE fails to install; cnfgsvr cannot start the instance service.
Windows XP, SP2; MSDE 2000 Release A - on some installs of the XP SP2 MSDE installation fails, the section of the install log that applies is: Executing "C:\Program Files\Microsoft SQL Server\80\Tools\Binn\cnfgsvr.exe -V 1 -M 1 -U sa -I "INSTANCE" -Q "SQL_Latin1_General_CP1_CI_AS"" MSI (c) (60:64) [19:21:20:734]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg Setup failed to configure the server. Refer to the server error logs and setup error logs for more information. MSI (s) (B4!F4) [19:21:33:546]: Product: Microsoft SQL Server Desktop Engine -- Setup failed to configure the ...Show All
Smart Device Development SqlConnection - How to connect?
Windows CE 4.2\.NET Compact Framework 2.0\VS2005 beta2\SQL Server 2000 I try to connect to remote database via SqlConnection class: SqlConnection con = new SqlConnection ( "User ID=fabdulov;password=123654;server=serverdf;database=storage" ); con.Open(); When I launch it on my PC - it works. But when I try to launch it on Windows CE - exception throws: Error symbol1.exe SqlException at SqlConnection.OnError() at SqlInternalConnection.OnError() at TdsParser.ThrowExceptionAndWarning() at TdsParser.Connect() at SqlInternalConnection.OpenAndLogin() at SqlInternalConnection..ctor() at SqlConnection.Open() at Form1.button1_click() etc... ...Show All
