Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: ListView being buggy Pin
Xmen Real 10-Nov-09 2:08
professional Xmen Real 10-Nov-09 2:08 
QuestionC# WebBrowser control setting folder views window blank until right-click [modified] Pin
Wheels01210-Nov-09 1:50
Wheels01210-Nov-09 1:50 
QuestionConvert Office 2007 Word document to PDF document Pin
mayurp610-Nov-09 1:13
mayurp610-Nov-09 1:13 
AnswerRe: Convert Office 2007 Word document to PDF document Pin
Russ-T10-Nov-09 2:51
Russ-T10-Nov-09 2:51 
GeneralRe: Convert Office 2007 Word document to PDF document Pin
mayurp610-Nov-09 21:24
mayurp610-Nov-09 21:24 
QuestionSymbols Pin
duminda198810-Nov-09 1:09
duminda198810-Nov-09 1:09 
AnswerRe: Symbols Pin
padmanabhan N10-Nov-09 1:23
padmanabhan N10-Nov-09 1:23 
Questionsql connection or another ???????????????? Pin
Mohamed El-Wehishy10-Nov-09 0:26
Mohamed El-Wehishy10-Nov-09 0:26 
high guys
i have a problem
when i press F5 on visual studio to start debugging of my project, it runs good no errors
but
when i press ctrl+F5 on visual studio to start without debugging of my project,it gets error message
the error message is:

Unhandled exception has occurred in your application. If you click Continue, the application  will ignore this error and attempt to continue. If you click Quit, the application will close immedediately.
the type initializer for 'System.Data.SqlClient.SqlConnection'threw an exception.
Details..
See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnection' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlConnectionFactory' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.Data.SqlClient.SqlPerformanceCounters' threw an exception. ---> System.PlatformNotSupportedException: This operation is only supported on Windows 2000 SP3 or later operating systems.
   at System.Security.Principal.SecurityIdentifier..ctor(WellKnownSidType sidType, SecurityIdentifier domainSid)
   at System.Diagnostics.SharedUtils.EnterMutexWithoutGlobal(String mutexName, Mutex& mutex)
   at System.Diagnostics.SharedPerformanceCounter.GetCounter(String counterName, String instanceName, Boolean enableReuse, PerformanceCounterInstanceLifetime lifetime)
   at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName, PerformanceCounterInstanceLifetime lifetime)
   at System.Diagnostics.PerformanceCounter.Initialize()
   at System.Diagnostics.PerformanceCounter.set_RawValue(Int64 value)
   at System.Data.ProviderBase.DbConnectionPoolCounters.Counter..ctor(String categoryName, String instanceName, String counterName, PerformanceCounterType counterType)
   at System.Data.ProviderBase.DbConnectionPoolCounters..ctor(String categoryName, String categoryHelp)
   at System.Data.SqlClient.SqlPerformanceCounters..ctor()
   at System.Data.SqlClient.SqlPerformanceCounters..cctor()
   --- End of inner exception stack trace ---
   at System.Data.SqlClient.SqlConnectionFactory..cctor()
   --- End of inner exception stack trace ---
   at System.Data.SqlClient.SqlConnection..cctor()
   --- End of inner exception stack trace ---
   at System.Data.SqlClient.SqlConnection..ctor()
   at System.Data.SqlClient.SqlConnection..ctor(String connectionString)
   at Computer_Sales_System.Form2.button1_Click(Object sender, EventArgs e) in D:\My first project\Computer Sales System\Computer Sales System\Form2.cs:line 178
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Computer Sales System
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///D:/My%20first%20project/Computer%20Sales%20System/Computer%20Sales%20System/bin/Debug/Computer%20Sales%20System.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
PresentationCore
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.1500 built by: QFE
    CodeBase: file:///C:/Windows/assembly/GAC_32/PresentationCore/3.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
WindowsBase
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.1500 built by: QFE
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/WindowsBase/3.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
System.Configuration
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
WindowsFormsIntegration
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.1500 built by: QFE
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/WindowsFormsIntegration/3.0.0.0__31bf3856ad364e35/WindowsFormsIntegration.dll
----------------------------------------
PresentationFramework
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.1500 built by: QFE
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/PresentationFramework/3.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
PresentationFramework.Aero
    Assembly Version: 3.0.0.0
    Win32 Version: 3.0.6920.1500 built by: QFE
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/PresentationFramework.Aero/3.0.0.0__31bf3856ad364e35/PresentationFramework.Aero.dll
----------------------------------------
System.Management
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Management/2.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
System.Data
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.3074 (QFE.050727-3000)
    CodeBase: file:///C:/Windows/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.


the code is:

SqlConnection cn = new SqlConnection(@"Data Source='MOHAMEDEWEHISHY\SQLEXPRESS';Initial Catalog='Computer Sales System';integrated security=sspi");
            try
            {
                SqlCommand cmd = new SqlCommand("backup_database", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                if (System.IO.File.Exists(@"D:\SQLServerBackups\Computer Sales System.bak"))
                {
                    System.IO.File.Delete(@"D:\SQLServerBackups\Computer Sales System.bak");
                }

                cn.Open();
                int i = cmd.ExecuteNonQuery();

                if (i < 0)
                {
                    MessageBox.Show("Your database is backed up successfully");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                MessageBox.Show("Sorry ... You can not back up your database");
            }
            finally
            {
                cn.Close();
            }


so the problem is using SqlConnection with others not DML commands
i tried to use OLEDBConnection but it not gets result


So what is the solution????????

Thanks,
Mohamed El-Wehishy
Questiondatatable to grid Pin
Member 59031010-Nov-09 0:00
Member 59031010-Nov-09 0:00 
AnswerRe: datatable to grid Pin
dan!sh 10-Nov-09 1:20
professional dan!sh 10-Nov-09 1:20 
QuestionSQL error Pin
spankyleo1239-Nov-09 23:17
spankyleo1239-Nov-09 23:17 
AnswerRe: SQL error Pin
Shameel9-Nov-09 23:50
professionalShameel9-Nov-09 23:50 
GeneralRe: SQL error Pin
spankyleo12310-Nov-09 3:31
spankyleo12310-Nov-09 3:31 
GeneralRe: SQL error Pin
Pete O'Hanlon10-Nov-09 3:42
mvePete O'Hanlon10-Nov-09 3:42 
GeneralRe: SQL error Pin
spankyleo12310-Nov-09 3:46
spankyleo12310-Nov-09 3:46 
GeneralRe: SQL error Pin
Shameel10-Nov-09 7:24
professionalShameel10-Nov-09 7:24 
QuestionHide shape in work document through C# Pin
Pankaj Saha9-Nov-09 22:57
Pankaj Saha9-Nov-09 22:57 
Questionpanel Pin
farokhian9-Nov-09 22:06
farokhian9-Nov-09 22:06 
AnswerRe: panel Pin
The Man from U.N.C.L.E.9-Nov-09 22:28
The Man from U.N.C.L.E.9-Nov-09 22:28 
QuestionSQL create table syntax error? Pin
Emmet_Brown9-Nov-09 22:01
Emmet_Brown9-Nov-09 22:01 
AnswerRe: SQL create table syntax error? Pin
Emmet_Brown9-Nov-09 22:05
Emmet_Brown9-Nov-09 22:05 
AnswerRe: SQL create table syntax error? Pin
Emmet_Brown9-Nov-09 22:24
Emmet_Brown9-Nov-09 22:24 
GeneralRe: SQL create table syntax error? Pin
Luc Pattyn10-Nov-09 1:10
sitebuilderLuc Pattyn10-Nov-09 1:10 
Questiontreeview?this problem has Troubled me for few days Pin
miss YY9-Nov-09 21:30
miss YY9-Nov-09 21:30 
AnswerRe: treeview?this problem has Troubled me for few days Pin
Pete O'Hanlon9-Nov-09 21:56
mvePete O'Hanlon9-Nov-09 21:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.