Insert into ReportDetail( Partcipantid, Reportid)
select distinct ParticipantID , 3 from abc where
closed = 0 and ( isnull ( primaryphone, ' )
View Complete Post
HI All,
How can I get the numbers of records affected in the Merge statement, INSERT,UPDATE,DELETE separately and store it in a variable so I can get it in the application side?
Thanks.
Hello Friends,
My requirement is, we have more than 5 database servers, each server lot of databases, each database lot of tables.
I want show the details
---------------------------------------------------------------
ServerName: abcServer
DatabaseName: xyzDatabase
MaximumRecordsTableName: empTable
-----------------------------------------------------------------
In asp or Classic asp.
please anybody help for code and query.
and
how to split the connection string in asp ?
I couldn't get the total record count in a, in my stored proc, in a given scenario. Please help
My SP looks like this:
create proc RecordCount
@CustomerID varchar(10),
@RecCnt int OUTPUT
as
begin tran
if(CustomerID = 'ABC')
@RecCnt = select count(*) from Customers where CustomerID='ABC'
commit
if(customerID='XYZ')
@RecCnt = select count(*) from Customers where CustomerID='XYZ' and TranDate > '05/01/2009'
GO
-- This is how I called my SP
declare @rc int
exec RecordCount 'XYZ', @RecCnt = @rc OUTPUT
select @rc
I have a page that is opened in a popup window from the main page. Once i click insert it pops up a message that says you have successfully added blah blah. Then once you click ok it closes the popup page and goes back to the main page. I want to be able to refresh the main page back to how it was when you first land on the page. Here is the code for my insert button:
<asp:button id="insertButton" style="background-image:url('Images/Button.gif'); text-align:center;background-color:Transparent; cursor:hand; background-repeat:no-repeat; background-position:left; padding-left:15px; font-family: 'Arial Unicode MS'; font-size: small; font-weight: bold;" Runat="server" Height="25px" BorderStyle=None ForeColor=White Text="Insert" Width="99px" CssClass="style13" CommandName="Insert" OnClientClick="javascript: alert('You have successfully added a New Donor!!');window.open('','_self','');window.close();" />
if i have a prodcut with product no. and each product is made by many parts with parts no. now i would like to retrieve data to count how many parts to make a product. in sql, can i count parts no. by each product no. like belows:
select product_no,parts_name,manufacture_date,(select count(*) from item where product_no=p.product_no) as [No. of items] from prodcut p left outer join item i on p.product_no=i.product_no
but i found that the execution time is too long, is it the right way to count no. of item in each product??
I put in break points, the problem starts when I get to this part:
public void InsertClients(string client_name, string client_lastname, int client_age) { cmd = new SqlCommand(); cmd.CommandText = "[dbo].[prcinsert_client]"; cmd.CommandTimeout = 0; cmd.CommandType = CommandType.StoredProcedure; cn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["myConnectionString"].ToString()); cmd.Connection = cn; cmd.Parameters.Add("@client_name", SqlDbType.VarChar, 12).Value = client_name; cmd.Parameters.Add("@client_lastname", SqlDbType.VarChar, 15).Value = client_lastname; cmd.Parameters.Add("@client_age", SqlDbType.Int, 4).Value = client_age; try { cn.Open(); cmd.ExecuteNonQuery(); // problem is here will not execute the query. cn.Close(); } catch (SqlException) { throw; // throw it back to the calling method. } }
I checked I can get all of my values. Here how I save my value in the bll:
public int Save_Client(string clientname, string clie
I would like to check and see if a record exists before doing an insert. Here is the code I have tried:
Imports System.Data Imports System.Data.SqlClient Imports Telerik.Web.UI Imports System.CodeDom Imports System.Web Imports System.Web.Security Imports System.Web.Security.Roles Imports System.Web.Security.Membership Imports System.Security Imports System.Security.Principal.WindowsIdentity Partial Class template Inherits System.Web.UI.Page Private Shared prevPage As String = String.Empty Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load If (Not IsPostBack) Then prevPage = Request.UrlReferrer.ToString() End If End Sub Protected Sub btn_Volunteer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim IDProfileVolunteer As String = Session("IDProfileVolunteer") Dim IDProfileOrganization As String = CType(FormView1.FindControl("hf_IDProfileOrganization"), HiddenField).Value Dim conn As SqlConnection Dim cmd As SqlCommand Dim strconnection, strsqlinsert As String Dim currentUser As MembershipUser = Membership.GetUser() Dim currentUserId As Gu
Pardon me, I'm just getting started with C#, but here goes:
I have an asp.net web page that allows the user to insert a new record in a database table named "featured_properties." The table has 3 fields (propID [int], dtDisplay [datetime], and lastdisplay [datetime]). propID corresponds to a unique id in a different table, which contains a field called "name" [varchar].
To insert a new record into "featured_properties", the user chooses a name from an asp:DropDownList, which is populated by the "name" field in the second table. The value of each name option in the dropdown list is the unique id number for that record, which will also serve as the propID number in featured_properties. This part is working fine.
<asp:DropDownList ID="ListOfProperties" runat="server" DataSourceID="MembersDataSource" DataTextField="PropertyName" DataValueField="ID"> </asp:DropDownList>
So I have a control that will provide a value for the "propID" field in the insert.
For the other two datetime fields (dtDisplay and lastdisplay), I've placed asp:Calendar controls on the page. I would like one to provide the value for StartDate and the other to Provide the valu
Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend