.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
sivanagamahesh
Post New Web Links

How it's possible to execute this code in C # WPF

Posted By:      Posted Date: August 28, 2010    Points: 0   Category :WPF
 
Hi I have this code but I do not know how to do him in WPF   IF EXISTS (SELECT * FROM YourTable WHERE Key = 123)    PRINT 'EXISTS' ELSE    PRINT 'Dont EXISTS'   There is My Code in c#         private void button2_Click_1(object sender, RoutedEventArgs e)           {             DataSet ds6 = new DataSet();             SqlConnection con6 = new SqlConnection("Data Source=PC;Initial Catalog=Veo;Integrated Security=True");             SqlCommand cmd = new SqlCommand("Select * from [MHGROUP].CUSTOM3", con6);             SqlDataAdapter sqlDa6 = new SqlDataAdapter();             sqlDa6.SelectCommand = cmd;             sqlDa6.Fill(ds6);             string mySelectedValue = comboBox2.Text;             int newid;             newid = Convert.ToInt32(mySelectedValue);  


View Complete Post


More Related Resource Links

Automatically Execute Code at certain time from website

  

Is there a way to trigger a piece of code to execute at a certain time once a week?

I basically want my website to send out a reminder email every sunday. I have a function called SendReminder() and I would like to know if it is posible for it to run by itself because at the minute I have to press a button to run it.

Thanks


Question about user used to execute code from app_code

  

 Hello. I would like to know something about code execution  in App_Code folder.

Under wich user executed code from app_code.

I'm using impersonate in web.config


execute a javascript function in code page

  
I use js function in source page and call that js function as below in Source page<a href="javascript:;" onclick="openwin('Sample.aspx?DID=<%#Eval("UID") %>', '', '700','300','yes'); return false ">I need to call this function from vb.net code page.....how to solve this ........???????????Give ur ideas...............

error code:0xC0024104 source: Reporting Task for subplan- Description: the execute method on the tas

  
Hi,

I am getting following error when running maintenance plan under schedule job. I am getting this error for maintenance cleanup task.  The job is not failing all the time but alternate weeks. I created same maintenance plan on test server(same configuration as PROD) and Maintenance cleanup task related job failed for first time and running fine from there. I don't know why it is causing failed. I checked maintenance plan history and it show successful each time. even i checked manually it deleted all the report files related to maintenance plan. History Cleanup task and Maintenance Cleanup task should not be created on same Maintenance Plan?....I know SQL Server 2005 had some problem with maintenance plan creation before SP2.

i wrote an code in button_click event and i want to execute the same code when i click another butto

  

Hello all ,

i wrote an code in button_click event and i want to execute the same code when i click another button

how can i do that ?


Kareem Naguib

SQL Server 2008 query execution time is different if i execute it in management studio or from code

  
When I execute query from software which i wrote in c# it required lots of time to complete but if I execute exactly the same query from management studio it will be done in seconds. In both cases execution plan is the same. 

Problem trying to execute ALTER SCHEMA from code

  

I have a visual basic application which needs to make some changes to a SQL Server database (either SQL Server 2005 or 2008).  Specifically, I am trying to eliminate a schema (e.g. MySchema) from the database altogether.  The first thing I must do is move all database objects from 'MySchema' to 'dbo'.  To that end, I execute the command:

ALTER SCHEMA dbo TRANSFER MySchema.ActionsCompleted

I am using an ODBC connection to the database.  There is a user name and password setup on the server that my application uses for all database access.  The error message I get is:

Cannot find the object 'ActionsCompleted', because it does not exist or you do not have permission.

When I run this exact statement from a query in SQL Server Mgmt Studio, it works fine.  The difference is the user (and therefore the permissions).  When I execute from the SQL Server Mgmt Studio, I am effectively an administrator, from my application, I am not.

So, I am trying to figure out what permissions I need to give my application to execute this line.  The documentation says that the user my have CONTROL priviledges over the securable (in this case the table called MySchema.ActionsCompleted) and ALTER priveledges on the dbo schema.  OK, so next I try the following (in SQL Server MGMT Studio):

GRANT ALTER ON

Stop execute code

  

I have a command button in a page. WHen user click on it delete record. In the onclick event i have inserted this code:

Dim script As String = "var $dialog = $('<div></div>').html('Record deleted!').dialog({autoOpen: false,modal: true,title: 'Eliminazione..',buttons: {Ok: function() {$(this).dialog('close');}}});$dialog.dialog('open');"

Page.ClientScript.RegisterStartupScript(Me.GetType, "test", script, True)

After this I want to redirect user to another page and I have inserted this code:

Response.Redirect("Contratti.aspx")

But If user click button no confirm window appear.

How I can do it?


Execute a JavaScript function from code behind

  

Hi All,

I have implemented the following progress bar;

http://mattberseth.com/blog/2007/07/google_analytics_like_ajax_pro.html

It works very well apart from i have a link on the Gridview which opens a ModalPopUp.  On the popup i have a close button which runs ModalPop.hide();  However the Progress Bar stays on the screen and I can't get rid of it??  This only happens when i have opened the Modal Popup - if i do a gridview sort the progress bar opens and hides as it should.

I have tried to execute the Java "OnUpdated" command like such but it dosent work either:

 

ClientScriptManager script = Page.ClientScript;

        if (!script.IsClientScriptBlockRegistered(this.GetType(), "Popup"))
        {

            script.RegisterClientScriptBlock(this.GetType(), "Popup", "<script type=text/javascript>onUpdated();</script>");

        }
        Panel2_ModalPopupExtender.Hide();


 

 Thanks all


Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust

  

Hi,

I want to pass parameter to Silverlight Control deployed as a Webpart.For this i used WebpartStorageAttribute for getting the values while configuring the Webpart.

It deployed Successfully but when i try to add webpart its raising the following error

Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: Could not load type 'Microsoft.SharePoint.WebPartPages.WebPartStorageAttribute' from assembly 'Microsoft.SharePoint, Version=14.900.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.

Thanks in Advance


Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

  
When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Free Code Snippets - ASP.NET

  
You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

  
Free C# Code Snippets

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Microsoft StyleCop: Source Code Analyzer for C#

  
StyleCop is similar in many ways to Microsoft Code Analysis (specifically FxCop), but there are some important distinctions. FxCop performs its analysis on compiled binaries, while StyleCop analyzes the source code directly. For this reason, FxCop focuses more on the design of the code, while StyleCop focuses on layout, readability and documentation. Most of that information is stripped away during the compilation process, and thus cannot be analyzed by FxCop.

HttpContext.Items and Server.Transfer/Execute

  
The problem was basically that when a Server.Transfer call was applied the script container (and also various ClientScriptProxy script embedding routines) would potentially fail to load up the specified scripts.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend