Help Send An Personal Email From Database Mail On Row Update-stored PROCEDURE Multi Update

May 27, 2008

hi need help how to send an email from database mail on row update
from stored PROCEDURE multi update
but i need to send a personal email evry employee get an email on row update
like send one after one email


i use FUNCTION i get on this forum to use split from multi update

how to loop for evry update send an single eamil to evry employee ID send one email

i update like this


Code Snippet
:

DECLARE @id nvarchar(1000)
set @id= '16703, 16704, 16757, 16924, 17041, 17077, 17084, 17103, 17129, 17134, 17186, 17190, 17203, 17205, 17289, 17294, 17295, 17296, 17309, 17316, 17317, 17322, 17325, 17337, 17338, 17339, 17348, 17349, 17350, 17357, 17360, 17361, 17362, 17366, 17367, 17370, 17372, 17373, 17374, 17377, 17380, 17382, 17383, 17385, 17386, 17391, 17392, 17393, 17394, 17395, 17396, 17397, 17398, 17400, 17401, 17402, 17407, 17408, 17409, 17410, 17411, 17412, 17413, 17414, 17415, 17417, 17418, 17419, 17420, 17422, 17423, 17424, 17425, 17426, 17427, 17428, 17430, 17431, 17432, 17442, 17443, 17444, 17447, 17448, 17449, 17450, 17451'
UPDATE s SET fld5 = 2
FROM Snha s
JOIN dbo.udf_SplitList(@id, ',') split
ON split.value = s.na
WHERE fld5 = 3

now
how to send an EMAIL for evry ROW update but "personal email" to the employee



Code Snippet
DECLARE @xml NVARCHAR(MAX)DECLARE @body NVARCHAR(MAX)
SET @xml =CAST(( SELECT
FirstName AS 'td','',
LastName AS 'td','' ,
SET @body = @body + @xml +'</table></body></html>'
EXEC msdb.dbo.sp_send_dbmail
@recipients =''
@copy_recipients='www@iec.com',
@body = @body,
@body_format ='HTML',
@subject ='test',
@profile_name ='bob'
END
ELSE
print 'no email today'


TNX

View 2 Replies


ADVERTISEMENT

The Multi Delete &&amp; Multi Update - Stored Procedure Not Work Ok

Feb 4, 2008

the stored procedure don't delete all the records
need help



Code Snippet
DECLARE @empid varchar(500)
set @empid ='55329429,58830803,309128726,55696314'
DELETE FROM [Table_1]
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0
UPDATE [empList]
SET StartDate = CONVERT(DATETIME, '1900-01-01 00:00:00', 102), val_ok = 0
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0
UPDATE [empList]
SET StartDate = CONVERT(DATETIME, '1900-01-01 00:00:00', 102), val_ok = 0
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0




TNX

View 2 Replies View Related

Stored Procedure Multi Update Problem - Limited Rows

May 25, 2008

hi need help
i have this stored procedure
the problem is that
i canot update like this not more than 20 - 30 rows
(i send it from a web page from check box)
it work but it limited rows for update not more than 20 - 30 rows
in one time



Code Snippet
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [sto_update_snha]
@id varchar(1000)
as
UPDATE Snha
SET fld5 = 3
WHERE charindex(','+CONVERT(varchar,[id])+',',','+@id+',') > 0 AND (fld5 = 2)




TNX

View 16 Replies View Related

Spaces Problem On Multi Update Delete Stored Procedure

Feb 5, 2008


spaces problem on multi update delete stored procedure
on the the insert i get it like this


58830803, 55329429, 308962604, 55696314, 309128726



as you see only the first empid=58830803 is without spaces
how to fix this
my code




Code Snippet
DECLARE @empid varchar(500)
set @empid ='58830803, 55329429, 308962604, 55696314, 309128726'
DELETE FROM [Table_1]
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0
UPDATE [empList]
SET StartDate = CONVERT(DATETIME, '1900-01-01 00:00:00', 102), val_ok = 0
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0
UPDATE [empList]
SET StartDate = CONVERT(DATETIME, '1900-01-01 00:00:00', 102), val_ok = 0
WHERE charindex(','+CONVERT(varchar,[empid])+',',','+@empid+',') > 0




TNX

View 4 Replies View Related

Database Mail - Send Test Email

Nov 23, 2006

i've got a brand new server and just installed SQL 2005.

when i try to send a test email, i get the following error message:

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 5 (2006-11-23T11:49:34). Exception Message: Could not connect to mail server. (No connection could be made because the target machine actively refused it). )

I have checked all items from troubleshoot and eveything is ok...any help ?

thanks



View 2 Replies View Related

Automate Row Update And Send Email?

May 11, 2004

I’d like to update rows matching a certain criteria each night automatically and then send an email.

I have a table with a Status column and an Expire Date column. I want to update rows where the Status = Open and the Expire Date < The current Date by changing the Status to Closed then send an HTML email. Do I have to write a program and schedule it to run or is there a way to do this in MS SQL? I looked at using a stored procedure but I don’t see how to schedule one to run (other than at startup) and I’m not sure if the GETDATE function can be called.

Thanks for any help.

Joe

View 4 Replies View Related

How To Send Mail To A Personal Distribution List (PDL) ?

Jul 27, 2007

Hi friends,
Though we can send mails to Individual addresses, I wonder what would be the Syntax to specify in the script task or Format to specify in a "To" Property of Send Mail task that I use to Send a mail to my Personal Distribution List (PDL).

Thanks
Subhash Subramanyam

View 9 Replies View Related

SQL 2012 :: Database Mail - Test Email Works But Jobs Won't Send Out Notifications

Oct 19, 2015

I am trying to send out notifications when jobs complete (fail or succeed). I have database mail working fine on my DEV server, but I am having issues with it on my PROD server. I am currently having people look into if McAfee may be blocking it.

I am able to send out a test email from SSMS>Management>Database Mail, but when I set a Notification for a job, the job will complete and in the history, it will say "NOTE: Failed to notify 'User' via email."

I have created an Operator and set up Profiles and Accounts, just as I did on my DEV server.

View 2 Replies View Related

Best Way To Send Email From A C# Stored Procedure?

Jul 2, 2006

I thought I could just copy over some asp.net code like:  System.Web.Mail.MailMessage mailMessage = new System.Web.Mail.MailMessage();
 But VS2005 doesn't seem to want me touching System.Web.Mail.
Any ideas?
Thanks,
Allen

View 6 Replies View Related

Stored Procedure Has To Send An Email !!!!

Mar 17, 2004

Hi,


I am trying to write a stored procedure in Sql Server that should send an email containing a query result everyday at 2:00 PM. How can I do this?? Im trying to use xp_sendmail but this gives me the following error:

Could not find stored procedure 'xp_sendmail'.

Plz let me know if there is any easy way to handle this.

Thanks a lot

View 3 Replies View Related

How To Send Email From Stored Procedure

Jan 30, 2014

I have an store procedure and I want to build an email with this store procedure to email me How can I use the email command to incorporate into my sql SP?

View 4 Replies View Related

How To Send Sql/stored Procedure Output In The Body Of The Email.

Nov 3, 2007

Everyday morning I email the sql query/stored procedure output results to the users, I was wondering if I can use some kind of t-sql code or DTS packages so that I can automate this process where I want to send the sql/stored proc results in the body of the email.

View 7 Replies View Related

Creating Stored Procedure To Send Email To Multiple Users

Sep 20, 2007

Hi Everybody,

I am trying to setup a stored procedure that runs through a Reminders table and sends an email to users based on DateSent field being smaller than todays date. I have already setup the stored procedure to send the email, just having trouble looping through the recordset.




Code Snippet


CREATE PROCEDURE [dbo].[hrDB_SendEmail]

AS

BEGIN


DECLARE @FirstName nvarchar(256),

@LastName nvarchar(256),

@To nvarchar(256),

@ToMgr nvarchar(256),

@Subject nvarchar(256),

@Msg nvarchar(256),

@DateToSend datetime,

@Sent nvarchar(256),

@ReminderID int,

@RowCount int,

@Today datetime,

@Result nvarchar(256)

-- Get the reminders to send


SELECT

@ReminderID = r.intReminderID,

@DateToSend = r.datDateToSend,

@FirstName = e.txtFirstName,

@LastName = e.txtLastName,

@To = e.txtEmail,

@Subject = t.txtReminderSubject,

@Sent = r.txtSent

FROM


(auto_reminders r INNER JOIN employee e ON r.intEmployeeID = e.intEmployeeID) INNER JOIN ref_reminders t ON r.intReminderType = t.intReminderTempID

WHERE


(((r.datDateToSend)<20/12/09) AND

((r.txtSent)='False'))

-- Send the Emails


WHILE(LEN(@To) > 0)

BEGIN


EXEC @Result = sp_send_cdosysmail @To, @ToMgr, @Subject, @Msg

END

-- Mark the records as sent

IF @Result = 'sp_OAGetErrorInfo'


BEGIN


SELECT @Sent = 'Error'

END
ELSE


BEGIN


SELECT @Sent = 'True'

END
UPDATE auto_reminders

SET


auto_reminders.txtSent = @Sent, auto_reminders.datDateSent = @Today

WHERE


intReminderID = @ReminderID

END

GO







From the code you can probably tell I am new to writing stored procedures, so I apologise for any obvious errors. My major problems are :-


how to loop through each record

how to get todays date

whether the struture of the procedure is correct
Also, if you think there is an easier way or a better method, please suggest it. I am open to any suggestions you may have,

Thanks in advance
Ben

View 1 Replies View Related

SQL Server 2000 - Send A Mail By Stored Procedure

Mar 3, 2008

can I send a mail by stored procedure?

View 5 Replies View Related

Best Way To Send Email From A Stored Procedure (dynamically Changing Paramenters And Attachment)

Jul 23, 2005

Hello everyone,I need advice of how to accomplish the following:Loop though records in a table and send an email per record. Emailrecipient, message text and attachment file name - that's all changesrecord by record.Is it doable from a stored procedure (easily I mean, or am I better offwriting a VB app)? There are so many options of sending mail from SQLserver - CDONTS, SQL MAIL TASK, xp_sendmail. What's easier to implementand set up?Thanks a lot!!!(links and fragments of sample code would be greatlyappreciated)Larisa

View 2 Replies View Related

Stored Procedure - Update Statement Does Not Seem To Update Straight Away

Jul 30, 2007

Hello,

I'm writing a fairly involved stored procedure. In this Stored Procedure, I have an update statement, followed by a select statement. The results of the select statement should be effected by the previous update statement, but its not. When the stored procedure is finish, the update statement seemed to have worked though, so it is working.

I suspect I need something, like a GO statement, but that doesnt seem to work for a stored procedure. Can anyone offer some assistance?

View 6 Replies View Related

Help With How To Send E-Mail (Parent - Child Matching Records) From SQL 2005 Stored Procedure.

Oct 31, 2007

Folks,Using NorthWind as Example: Parent Table derived from: Categories. I added a new Column E-Mail and Selecting rows where Category Id <=3. Here is my Data.




Category ID
Category Name
Category E-mail

1
Beverages
Beverages.com

2
Condiments
Condiments.com

3
Confections
 Child Table derived from: Products. I am Selecting rows where Category Id <=3. Here is my Sample Data.




Category ID
Product Name
Quantity Per Unit

1
Chang
24 - 12 oz bottles

1
Côte de Blaye
12 - 75 cl bottles

1
Ipoh Coffee
16 - 500 g tins

1
Outback Lager
24 - 355 ml bottles

2
Aniseed Syrup
12 - 550 ml bottles

2
Chef Anton's Gumbo Mix
36 boxes

2
Louisiana Hot Spiced Okra
24 - 8 oz jars

2
Northwoods Cranberry Sauce
12 - 12 oz jars

3
Chocolade
10 pkgs.

3
Gumbär Gummibärchen
100 - 250 g bags

3
Maxilaku
24 - 50 g pkgs.

3
Scottish Longbreads
10 boxes x 8 pieces

3
Sir Rodney's Scones
24 pkgs. x 4 pieces

3
Tarte au sucre
48 piesI would like to read 1st Category Id, Category E-Mail from Categories Table (ie. Category Id = 1),  find that in Products Table. If match, extract matching records for that Category from Both Tables (Categories.CategoryID, Products.ProductName, Products.QuantityPerUnit) and e-mail them based on E-Mail Address from Parent (Categories ) Table. If no E-Mail Address is listed, do not create output file. In this instance Category Id = 3.Basically I want to select 1st record from Parent Table (Here is Category) and search for all matching Products in Products Table. And Create an E-mail and sending just those matching records. Repeat the same process for remaining rows from Categories Table. I am expecting my E-Mail Output like this: For Category Id: 1




Category ID
Product Name
Quantity Per Unit

1
Chang
24 - 12 oz bottles

1
Côte de Blaye
12 - 75 cl bottles

1
Ipoh Coffee
16 - 500 g tins

1
Outback Lager
24 - 355 ml bottlesFor Category Id: 2




Category ID
Product Name
Quantity Per Unit

2
Aniseed Syrup
12 - 550 ml bottles

2
Chef Anton's Gumbo Mix
36 boxes

2
Louisiana Hot Spiced Okra
24 - 8 oz jars

2
Northwoods Cranberry Sauce
12 - 12 oz jarsI am not extracting the Data for any user Interface (ie. Grid View/Form View Etc). I will just create a Command Button in an ASP.NET 2.0 form to extract Data. My Tables are in SQL 2005. I was thinking to read the Category records in a Data Reader and within the While Loop, call a SP to retrieve the matching records from Products Table. If matching records found, call System SP_Mail to send the E-mail. The drawback with that for every category records (Within While Loop) I need to call my SP to get Products Data. Will be OVERKILL? Ideally I would like extract my records with one call to a SP. Is there any way I can run a while loop inside the SP and extract Child Data based on Parent Record?  Any Help or sample URL, Tutorial Page will be appreciated.  Thanks
 

View 3 Replies View Related

A Question About Using Stored Procedure To Update Database?

Jun 19, 2006

A stored procedure was created to update a database.
But, I don't know how to trigger it in code:
This is the example to create a dataset for Dropdownlist,
Dim da As New SqlDataAdapter(myCommand)
Dim ds AS DataSet = new DataSet() da.Fill(ds)
This way doesn't work for triggering the stored procedure for updating database
How to trigger the stored Procedure for updating the database in the code?
 
Thx.

View 1 Replies View Related

How To Send Email Using Asp.net 2.0 And How To Find The Smtp Mail Server Name?

Dec 19, 2006

How to send email using asp.net 2.0 and how to find the smtp mail server name?

View 1 Replies View Related

JDBC 2005 Update Statement - Failing Multi Row Update.

Nov 9, 2007

It appears to update only the first qualifying row. The trace shows a row count of one when there are multiple qualifying rows in the table. This problem does not exist in JDBC 2000.

View 5 Replies View Related

Any Easy Class Method To Update About 100 Fields Of A Database Using Stored Procedure?

Feb 1, 2007

Hi all,
 I am using  C# for ASP.NEt 2003.
I would like to know if there is any easy method to update a database with about 100 fields in it.
At present, I pass all the values of the controls on the web form to the stored procedure as parameters like :-
myCommand.Parameters.Add("@CustomerID", SqlDbType.Int).Value = txtCustomerID.text
Like this,  I add all 100 parameters.
Is there any easy method to do it using a class or any other methods?
Thanking you in advance,
Tomy

View 2 Replies View Related

How To Automated Send Email To Inform The Status Number Of Data In Database Using Stored Procedures?

Feb 23, 2008

Hi ,

I'm just new in this SQL 2005, and I do not reallly sure the subject is right or not but as example in this link below

http://msdn2.microsoft.com/en-us/library/ms190307.aspx

I want updated to few of person of any changes in database just by sending to their emails in every 2 hours as an example. I go through the example given but I do not know the step how to run stored procedures. The Information that I want to give to them is like as:

Date From : 23/02/2008
Date To: 24/02/2008
Number of user : 3

My draft table is like this

Sequence_No Submitted_Dt Name
-------------------- ------------------- ------------------------


1 2/21/2008 4:16:45 PM John
2 2/22/2008 4:16:45 PM Dean
3 2/23/2008 4:16:45 PM Rick
4 2/24/2008 4:16:45 PM Van


thanks to all of your corcern to help me

Regards;

View 13 Replies View Related

How To Get An Email To Update A Database?

Nov 12, 2004

Can I send an email that will update a database table? say someone replies 'yes' to the email, where would I start to place that yes answer into the database table?

Thank-you,
Eric

View 10 Replies View Related

SQL 2005 E-mail Client Failing To Send Email Based On Job Status....

Mar 4, 2008

Kind of a newby sql question, but here goes:I have a sql 2005 database that I have a job that runs Sunday morning at 12:30 am.  I set it up using SQL Svr Mgt Studio 2005. Under  the Management directory I set up Database Mail to work with my local SMTP server. I can send a test email just fine.I then set myself up as an operator with my email address. (Under operators directory) I then went back to the properties of the job I set up, and under 'notification', chose e-mail operator (me) when Job Succeeds. The job runs, itt suceeds, but NO email!It flat out won't work. there are NO entries in teh( email) log for errors either.  Anyone? TIA  Dan  OR is it better to script these jobs using xml? I don't have time to learn a new thing right now, just need it to work!  

View 1 Replies View Related

SQL Server 2014 :: Passing Malformed Email Address To Send Mail Task?

Feb 5, 2015

I am implementing a fax solution (Right Fax) and pulling email information from a table and passing into a variable. In order to send out a fax via email, the syntax is in the following example below:

Example:

To send a fax from Outlook to Jane Doe at 555-1212, enter:

[RFAX:Jane Doe@/FN=555-1212]

When the following syntax gets passed into the Send Mail Task, into the "To" line and the package is executed I'm receiving the following.

[Send Mail Task] Error: An error occurred with the following error message: "The specified string is not in the form required for an e-mail address.".

[Send Mail Task] Warning: The address in the "To" line is malformed. It is either missing the "@" symbol or is not valid.

I realize it’s a malformed email address. Is it possible to create a group and instead of the fax syntax pass the group name?

View 8 Replies View Related

Update SQL Personal Edition Service Pack 3

Dec 7, 2004

Please do not tell me to go to the MS site coz I did not see any helpful step by step how to install this service pack to my SQL Personal Edition. So please anyone, SQL Guru, post here how to install the SP3 for PERSONAL EDITION - not the DESKTOP Engine. Thank you so much...

View 3 Replies View Related

Help With Mail That Send Mail When Database Bakcup Fails

Sep 1, 2006

Hello

I have got a script which gives the mail to the dba mail box when database backup fails.

In the script I want to make a change so that I get the particular database name , on what ever database i implement.

Can you tell me some suggestions.

The script I am using is :



use master
go
alter PROCEDURE dbo.SendMail
@to VARCHAR(255),
@subject VARCHAR(255),
@message VARCHAR(8000)
AS
BEGIN
SET NOCOUNT ON;
DECLARE
@rv INT,
@from VARCHAR(64),
@server VARCHAR(255);
SELECT
@from = 'testsql2000@is.depaul.edu',
@server = 'smtp.depaul.edu';


select @message = @message + char(13) + Char(13) + @@servername + '-'+ db_name()+ '-' + 'Backup Status Failed' + Char(13)

EXEC @rv = dbo.xp_smtp_sendmail
@to = @to,
@from = @from,
@message = @message,
@subject = @subject,
@server = @server;
END
GO




--- After the above script is run the following should be given in the 2nd step when
--- the backup jobs are scheduled ------

exec master.dbo.sendmail
@to = 'dvaddi@depaul.edu',
@subject =' Test sqlserver 2000',
@message = '' ;




Thanks

View 4 Replies View Related

Procedure To Send An Email Reminder Help?

Apr 21, 2004

Hi guys,I hope somebody can help as I am trying to write a procedure in SQL that will be an email reminder sent to users on every 5 th or the month if they don't submit data before.

I am quite new to sql and procedures in particular so I was hoping somebody can help.

I need to:
1.Check the day of the month, if not 5th do nothing

2.Get the date of the prevoious month (get current date - 1 month,set day to 1)this is the funny bit.
I have a field DateEntered,but users only select the month and the year on the acctual page,but when submitted it gets written as a full date and defaults to the 1st of the month.

3.Get the list of hospitals that haven't got data for the previous month

4.Email the hospitals.

DECLARE @returnDay int;
DECLARE @DateEntered datetime;

SELECT @returnDay = DatePart(day,GetDate())
If @returnDay = 5 (syntax error near 5)
BEGIN
SELECT @DateEntered = GetDate() - 30
Print DatePart(month, @DateEntered)

I was hoping somebody could look at this and help me.

thanks

View 3 Replies View Related

Store Procedure -auto Send Email

Jun 11, 2007

hi there, i m newbie in using the ms sql server.i wouldlike to learn how to write the store procudure.i hope u all can guide me on this.
i have one table with data
appid int (PK)
leaveappid int (FK)
firstapproval int
firstapproval email varchar,
2nd approval int
2nd approval email varchar
resutl firstapproval
result secondapproval.
i would like to do a automatic send mail function where: the first mail will send to the firstapproval email.if after 2 days, the firstapproval no response(the result firstapproval is empty) then the email will automatic send to the second approval. how can i write the SP for this case? i really have no idea to start since i duno how to write the SP syntax and dont have the concept too.
hope can hear from u all soon.
thanx

View 1 Replies View Related

MS SQL 6.5 Procedure To Send Query Results Via Email

Jul 20, 2005

Hi,I'm not sure if this is possible as i've googled everywhere, but i have aselect query that returns a customer record with their associated salesorders. I would like to automate a process which sends an email reminder toeach customer in the database, that has outstanding orders. This emailreminder should have the results of the query regarding their account.The table structure are as follows.---------------------Customer_tbl---------------------CustomerIDAccountNoNameEmailAddress---------------------Order_tbl---------------------OrderIDCustomerIDReferenceAmountDateOutstanding_flgCan anyone help?Sen.

View 2 Replies View Related

Need Help With A SQL Update Stored Procedure

Jun 16, 2006

Can someone walk me through the code for my update_command event?Every article I read and every tutorial I walk through has a slightly different way of doing this task.It's confusing trying to understand which code-behind variables I need in my update_command event and how to pass them to a stored procedure.
Please help me connect the dots.
I have a SQL server table that looks like this (Both data types are char)
Status_Id            Status_DescriptionA                    ActiveP                    Planned
I have a SQL stored procedure that looks like this…
create procedure dbo.usp_Update_Status_Master(@status_id char(1),@status_description char(30))asupdate status_masterset status_description = @status_descriptionwhere status_id = @status_idGO
Here is my code behind…
Imports SystemImports System.DataImports System.Data.SqlClientImports System.ConfigurationImports System.Data.OdbcPublic Class WebForm1    Inherits System.Web.UI.Page    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        If Not IsPostBack Then            Call LoadStatusMasterGrid()        End If    End Sub    Public Sub LoadStatusMasterGrid()        Dim connection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("sqlConn"))        connection.Open()        Try            Dim command As SqlCommand = _                New SqlCommand("usp_Select_Status_Master", connection)            Command.CommandType = CommandType.StoredProcedure            Dim adapter As SqlDataAdapter = New SqlDataAdapter(Command)            Dim table As DataTable = New DataTable            adapter.Fill(table)            dgStatusMaster.DataSource = table            dgStatusMaster.DataKeyField = "status_id"            dgStatusMaster.DataBind()        Catch ex As Exception            Console.WriteLine(ex.Message)            Throw        Finally            connection.Close()        End Try    End Sub    Private Sub dgStatusMaster_EditCommand(ByVal source As Object, _    ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgStatusMaster.EditCommand        dgStatusMaster.EditItemIndex = e.Item.ItemIndex        dgStatusMaster.DataBind()        Call LoadStatusMasterGrid()    End Sub    Private Sub dgStatusMaster_CancelCommand(ByVal source As Object, _    ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgStatusMaster.CancelCommand        dgStatusMaster.EditItemIndex = -1        Call LoadStatusMasterGrid()    End Sub    Private Sub dgStatusMaster_UpdateCommand(ByVal source As Object, _    ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgStatusMaster.UpdateCommand   ‘ How do I code this part?        End SubEnd Class
Thanks in advance for taking the time.Tim  

View 1 Replies View Related

Update To Stored Procedure

Feb 18, 2008

hi
i have 2 columns linked ( 1 to a textbox and the other to drop down list)
when i try to update i get 1 of the to the update SP but not the other and get this error
Procedure or Function 'Update_ActiveCity' expects parameter '@Cities', which was not supplied.
 
 
_________________ this is the code of the aspx ____________
 
<asp:GridView ID="grdD" runat="server" AutoGenerateColumns="False" DataKeyNames="CountryCode" DataSourceID="dsGrdD" OnRowDataBound="grdD_RowDataBound"><Columns><asp:TemplateField><ItemTemplate>
<asp:TextBox ID="txtCountry" runat="server" Text='<%# Bind("Country") %>' />
<asp:DropDownList ID="ddlCities" runat="server" />
</ItemTemplate></asp:TemplateField></Columns></asp:GridView>
 
<asp:SqlDataSource ID="dsGrdD" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
SelectCommand="Select_Cities" SelectCommandType="StoredProcedure" UpdateCommand="'Update_ActiveCity' " UpdateCommandType="StoredProcedure" CacheExpirationPolicy="Sliding">
<SelectParameters> <asp:SessionParameter Name="ListCode" SessionField="ListCode" Type="String" /> </SelectParameters>
</asp:SqlDataSource>
_______________________ this is the code behind ____________________protected void grdD_RowDataBound(object sender, GridViewRowEventArgs e)
{DropDownList ddl = e.Row.FindControl("ddlCities") as DropDownList;if (ddl != null)
{
string s = DataBinder.Eval(((GridViewRow)e.Row).DataItem, "Cities").ToString();ddl.DataSource = s.Split(',');
ddl.DataBind();
}
}
_______________________________________________________________________________-

View 9 Replies View Related

Update Stored Procedure

May 3, 2008

here is the procedureALTER PROCEDURE dbo.UpdateContact
(@ContactId bigint,@FirstName nvarchar(50),
@LastName nvarchar(50),@Telephone nvarchar(50),
@Addressline nvarchar(150),@State nvarchar(100),
@City nvarchar(100),@PostalCode varchar(50),
@Email nvarchar(50),
@MobilePhone varchar(50))
AS
SET NOCOUNT ON
 UPDATE ContactSET FirstName = @FirstName,
LastName = @LastName,
Telephone = @Telephone,
MobilePhone = @MobilePhone,
Email = @Email,
Addressline = @Addressline,
City = @City,
State = @State,
PostalCode = @PostalCodeWHERE ContactId = @ContactId
 
RETURN
what is the problem if i execute the storedprocedure separately it is working but when i call the storedprocedure in the code it fails.
It gives an error as "syntax error near Updatecontact"
Any ideas???
 

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved