SQL Mail Error Invalid Parameter '@@query'

Dec 8, 1998

What I'm trying to do is straight out of the SQL Server Help as below:

Create Procedure SP_WebNotifySupport (@c8_callid varchar(8), @vc50_yourname varchar(50))
As
Set NoCount ON
DECLARE @vc30_CmpnyNme varchar(30), @vc50_subject varchar(50)


Select @vc30_CmpnyNme = CmpnyNme from Profile where name = @vc50_yourname


CREATE TABLE #texttab (c1 text)
INSERT #texttab Select CallDesc from CallLog where CallID = @c8_callid

Select @vc50_subject = @vc30_CmpnyNme + ' Issue ' + @c8_callid

DECLARE @@cmd varchar(56)
SELECT @@cmd = 'SELECT c1 FROM #texttab'
EXEC master.dbo.xp_sendmail 'jcraddock', @@query = @@cmd, @@no_header= 'TRUE', @@subject = @vc50_subject
DROP TABLE #texttab


Set NoCount OFF
Go

View 1 Replies


ADVERTISEMENT

Error In Query; Invalid Length Parameter Passed To The Substring Function

Nov 28, 2005

Hi
i got errro mess "Invalid length parameter passed to the substring function" from this below. Anyone how can give me a hint what cause this, and how i can solve it? if i remove whats whitin thoose [] it works, i dont use [] in the code :)
colums:
VLF_InfectionDestination is nvarchar 254

SELECT TOP 10 tb_AVVirusLog.VLF_VirusName, COUNT(tb_AVVirusLog.VLF_VirusName) AS number
FROM tb_AVVirusLog INNER JOIN
__CustomerMachines002 ON tb_AVVirusLog.CLF_ComputerName = __CustomerMachines002.FalseName
WHERE (CONVERT(varchar, tb_AVVirusLog.CLF_LogGenerationTime, 120) BETWEEN @fyear + @fmonth + @fday AND @tyear + @tmonth + @tday) AND
(__CustomerMachines002.folder_id = @folderId) [OR
(CONVERT(varchar, tb_AVVirusLog.CLF_LogGenerationTime, 120) BETWEEN @fyear + @fmonth + @fday AND @tyear + @tmonth + @tday) AND
(tb_AVVirusLog.VLF_InfectionDestination LIKE N'%@%')]
GROUP BY tb_AVVirusLog.VLF_VirusName
HAVING (NOT (tb_AVVirusLog.VLF_VirusName LIKE N'cookie'))
ORDER BY COUNT(tb_AVVirusLog.VLF_VirusName) DESC

View 7 Replies View Related

DTS Invalid Parameter Error

Apr 30, 2001

I am running SQL 7 Svc Pack 2 on TN 4.0 Svc Pack 6a.

I am getting the following error when opening up a DTS package on my SQL Server from EM on my workstation. If I open it up on the server by using pcanywhere the package opens fine. Ther error is a dialogue box stating:

Package Error

Error Source:Microsoft Data Transformation Services (DTS) Package
Error Description: The Parameter is incorrect.

Has anyone seen this. I get nothing in the event log or SQL logs. I can't seem to figure this one out.

View 3 Replies View Related

Error - Invalid Parameter Binding

Nov 11, 2014

While trying to execute the below query I get an error "Invalid Paramter Binding.

SELECT RELEASE_CYCLES.RCYC_NAME+' : '+ CYCL_FOLD.CF_ITEM_NAME /*Test Set Folder (CYCLE).Name*/ as "Cycle Name : Test Component",
SUM(case when t3.status='Passed' then 1 else 0 end) "Passed",
SUM(case when t3.status='Failed' then 1 else 0 end) "Failed",
SUM(case when t3.status='Not Completed' then 1 else 0 end) "Not Completed",
SUM(case when t3.status='No Run' then 1 else 0 end) "No Run",
SUM(case when t3.status in ('Passed','Failed','Not Completed','No Run') then 1 else 0 end) "Total",

[code]....

View 5 Replies View Related

DTS & SP3: Chronic "Invalid Parameter" Error Remedied

Jan 7, 2001

FYI. Perhaps I missed it on the Fix List, but applying SP3 to my Win2K Professional workstation w/ SQL Server 7 Desktop Edition remedied a chronic error I'd been receiving when trying to open a pre-existing DTS package which resided on other servers. For weeks, no matter what I've tried, I've been getting a message box saying "Invalid Paramter". (I didn't go as far as an uninstall / re-install, but I did about everything short of that.) After applying SP3, the DTS packages open up easily.

View 1 Replies View Related

Error: Invalid Length Parameter Passed To The SUBSTRING Function.

Sep 28, 2007

Hi,

I am using a simple procedure to pivot results (found in another forum and adapted it). It is done on SQL Server 2005 server with all service packs. Procedure:
**************
ALTER Procedure [dbo].[EthnicityPivot] @StDate as Datetime, @EndDate as Datetime
as
begin
DECLARE @Teams varchar(2000)

truncate table ForEthnicPivot

INSERT INTO ForEthnicPivot
SELECT DISTINCT COUNT(ID), Team, Ethnicity
FROM dbo._EthnicityByTeamEpisode
where Startdate between @StDate and @EndDate
GROUP BY Ethnicity, Team

SET @Teams = ''
--// Get a list of the pivot columns that are important to you.

SELECT @Teams = @Teams + '[' + Team + '],'
FROM (SELECT Distinct Team FROM ForEthnicPivot) Team
--// Remove the trailing comma

SET @Teams = LEFT(@Teams, LEN(@Teams)-1)
--// Now execute the Select with the PIVOT and dynamically add the list
--// of dates for the columns
EXEC( 'SELECT * FROM ForEthnicPivot PIVOT (SUM(countID) FOR Team IN (' + @Teams + ')) AS X' )
end
************

I can call the function:
exec EthnicityPivot '01/01/2007','09/09/2007'

and it works fine in SQL analyzer, but when I want to use it in Visual Studio in a new report I am getting this error
message:

There is an error in the query. Invalid length parameter passed to the SUBSTRING function. Incorrect syntax near ')'.

Anyone had similar error and sorted it?

Cheers

Polda

View 4 Replies View Related

SQLDescribeParam With Subselect: Invalid Parameter Number/Invalid Descriptor Index

Apr 21, 2008

Hello,

I've got the following query:

SELECT zA."ID" AS fA_A
, zA."TEXT" AS fA_B
, (
SELECT COUNT(zC."ID")
FROM Test."Booking" AS zC
) AS fA_E
FROM Test."Stack" AS zA
WHERE zA."ID" = ?

With this query I call:
- SQLPrepare -> SQL_SUCCESS=0
- SQLNumParams -> SQL_SUCCESS=0, pcpar = 1
- SQLDescribeParam( 1 ) -> SQL_ERROR=-1, [Microsoft][ODBC SQL Server Driver]Invalid parameter number", "[Microsoft][ODBC SQL Server Driver]Invalid Descriptor Index"

Is there a problem with this calling sequence or this query? Or is this a problem of SQL Server?

Regards
Markus

View 7 Replies View Related

Pre-requisiste Install Error 87 Invalid Parameter From SQL 2005 Dev Ed On Server 2008 RC0

Oct 2, 2007

The subject pretty much sums the problem up. I am trying to get a database installed on Server 2008 RC0. The public information says SQL 2005 SP2 should work, but I cannot get the base SQL 2005 installed in order to apply the service pack. When I run the installation, I immediately get an error when trying to install the pre-requisites. Specifically, the .NET 2.0 Framework errors with code 87, "invalid parameter".

I have found a couple references to this error code, but nothing to do with Server 2008 and RC0. I have tried using a directory with no spaces, and tried the EXE vs ISO installation, but they everything fails. I don't know if there is a way to bypass the .NET 2.0 Framework install - since it's already on the machine anyway.

Thanks in advance for any help!

View 8 Replies View Related

Odd Error Upon SqlDataReader.Read() Invalid Length Parameter Passed To The Substring Function.

Nov 12, 2003

An application I developed normally works great, but it seems that when processing a certian record (and none of the others so far), SQL Server throws this error:
"Invalid length parameter passed to the substring function."

Here's the code in question:

orderConnection.Open()
orderReader = orderCommand.ExecuteReader()
setControls(orderReader)

...

Private Sub setControls(ByVal dr As SqlDataReader)
If (dr.Read()) Then '<--*******problem line*******

The SqlDataReader (orderReader) doesn't blow up or anything until I call .Read() (and, as mentioned, this problem only occurs for one order). What could be happening here?

View 3 Replies View Related

Query Error: Invalid Object Name

Sep 26, 2005

I'm getting the following error when I try to add a new record to the db:System.Data.SqlClient.SqlException: Invalid object name 'Pub_Points'. My table is called Pub_Points. I've had an insert working before.This is the SQL string that I'm trying to send:INSERT INTO Pub_Points ('PPName','Encoder_URL','Connect_Type','Archive','Creation_Date') VALUES ('fu','barr','local ','19/26/2005 13:35:27')Yet updating an existing record during the same run works fine:UPDATE Pub_Points SET PPName='foo ', Encoder_URL='bar', Connect_Type='remote ', Archive='0' Where ID='114' So it can't be a problem finding the table itself.Only two things I can see that are different:- the Insert procedure first creates and attaches the formatted date string (which you see already inserted in the Insert query)- the database has an auto-generating key field 'ID' (which you see being referenced in the UPDATE query)but I don't see how either of those things would give me this error.Ideas?

View 1 Replies View Related

Error: The XmlDb Query Is Invalid

Sep 20, 2006

Hi,

I was working on the MSDN Tutorial "Using XML Data in a Report", Lesson 2: Defining a Report Dataset for an ADO.NET DataSet from a Web Service at the follwoing link http://msdn2.microsoft.com/en-us/library/aa337489.aspx

When i run the following query, everything goes as expected (i.e. the displayed data is the extracted data from all XML elements and attributes down to the leaf node on the first XML path it finds in the dataset )

<Query>
<SoapAction>
http://tempuri.org/GetEmployeeManagers
</SoapAction>
<Method Namespace="http://tempuri.org/"
Name="GetEmployeeManagers">
</Method>
</Query>

But when i add the other section to specify the elements to be used in retrieving the data

<ElementPath IgnoreNamespaces="True">
GetEmployeeManagersResponse {}/
GetEmployeeManagersResult/diffgram{}/
Results {}/Table
</ElementPath>

the following error is dispalyed:

===================================

An error occurred while creating a data extension command.
The XmlDP query is invalid. (Microsoft Report Designer)

The XmlDP query is invalid. (Microsoft.ReportingServices.DataExtensions)

There are multiple root elements. Line 9, position 2. (System.Xml)

===================================

I would appreciate much if u helped me in this problem

Thank you,

View 1 Replies View Related

SQL Query Analyzer Invalid Object Name Error

Jun 11, 2007

We have several databases but one is behaving differently in SQL Query Analyzer. Please assume we have selected the correct db in the the pull-down and assume database name is DB1 and table name is Table1

SELECT *
FROM db1.[table1]
works fine.

SELECT *
FROM [table1]
returns "Invalid Object Name Error".

This problem causes some complex queries not to work so I'd like to know if this db has some special setting that requires explicit db name in each query.

We have also tried..
use [db1]
SELECT *
FROM [table1]

It still gives the same error.
Any help would be appreciated.
Thansk

Notalian

View 3 Replies View Related

Open Query Error: Invalid Data For Type Numeric.

Dec 13, 2005

Hi guys....

View 10 Replies View Related

DB Engine :: Error Message When Trying To Create Any Query - Directory Name Invalid

Apr 3, 2007

I am trying to run a query on my sql server and get the following error message:
 
"An error occurred while executing batch. Error message is: The directory name is invalid."
 
how do I fix?

View 14 Replies View Related

Database Mail Problem...Query Execution Failed: Error Initializing COM

Jun 1, 2007

Hello -



I'm having a problem sending the query set as an email text attachment. Test transmissions from Database mail working fine.

Send simple messages with the sp_send_dbmail sproc works fine as well.



It is only when I try and send a query result that things blow up. The query itself is working fine also, so I'm now down to think there is some esoteric problem with the sproc itself.



Surface config features have database mail on, and SQL Mail off.



Anyone know the solution to this?



Thanks in advance!



Actual SQL ...



use epic
go

EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQLMail',
@recipients = 'rvolters@whaleyfoodservice.com',
@body = 'Testing sqlmail with sproc.',
@subject = 'Orders with invalid tech numbers',
@query = 'SELECT order_no, order_ext, line_no from epic..STG_BNERPT_INVALIDTECHNOS' ,
@attach_query_result_as_file = 1 ;





Message Results...



Msg 14661, Level 16, State 1, Procedure sp_send_dbmail, Line 476
Query execution failed: Error initializing COM
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.



Investigating the sproc itself shows...




Line 476 in the sproc is the beginning of a 'trap'
--Raise an error it the query execution fails
-- This will only be the case when @append_query_error is set to 0 (false)
IF( (@RetErrorMsg IS NOT NULL) AND (@exclude_query_output=0) )
BEGIN
RAISERROR(14661, -1, -1, @RetErrorMsg)
END

RETURN (@rc)
this is the last section of code in the sproc

View 2 Replies View Related

DB Mail And Notify Operator Through DB Mail Error Could Not Retrieve Item From The Queue

Feb 2, 2007

I've set up DB mail and sent a test e-mail and that comes through fine.

I set up an Operator with email Name: DWhelpton@k-and-s.com;MWeaver@k-and-s.com

I created a job and set up the notifications to e-mail the operator on failure.

When the job runs and fails, I do not get an e-mail and I get the following exception in the db mail log:

Date 2/2/2007 8:35:00 AM
Log Database Mail (Database Mail Log)

Log ID 402
Process ID 3936
Last Modified 2/2/2007 8:35:00 AM
Last Modified By NT AUTHORITYSYSTEM

Message
1) Exception Information
===================
Exception Type: Microsoft.SqlServer.Management.SqlIMail.Server.Common.BaseException
Message: Could not retrieve item from the queue.
Data: System.Collections.ListDictionaryInternal
TargetSite: Microsoft.SqlServer.Management.SqlIMail.Server.Controller.ICommand CreateSendMailCommand(Microsoft.SqlServer.Management.SqlIMail.Server.DataAccess.DBSession)
HelpLink: NULL
Source: DatabaseMailEngine

StackTrace Information
===================
at Microsoft.SqlServer.Management.SqlIMail.Server.Controller.CommandFactory.CreateSendMailCommand(DBSession dbSession)
at Microsoft.SqlServer.Management.SqlIMail.Server.Controller.CommandFactory.CreateCommand(DBSession dbSession)
at Microsoft.SqlServer.Management.SqlIMail.Server.Controller.CommandRunner.Run(DBSession db)
at Microsoft.SqlServer.Management.SqlIMail.IMailProcess.ThreadCallBack.MailOperation(Object o)


What step am I missing?

View 1 Replies View Related

SMTP Database Mail Showing Error While Sending Mail

Mar 7, 2007

Lokendra writes "I have configured the Database mail profile and account in Sql Server 2005 but the mail is not sending and showing the following error message:

Error,235,The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2007-03-05T15:16:07). Exception Message: Cannot send mails to mail server. (Mailbox name not allowed. The server response was: Sorry<c/> that domain isn't in my list of allowed rcpthosts.).
),3000,90,,3/5/2007 3:16:07 PM,sa


but while in the same mail set up in previous instance of sql server 2005 the message was sending very well. After installing new instance of sql server 2005 the problem is arising.


Anybody can tell me that what I can do so that i can send mail using the SMTP databasemail account."

View 1 Replies View Related

Error Sending Mail With Send Mail Task

Feb 6, 2008

I keep getting a generic "Error Sending Mail" error. For testing purposes I am just trying to send using my own email account. What goes in the SMTP Server box in the connection manager? I have tried:

A - the exchange server address (SOMETHING.us.company.com)
B - The SMTP properties I see when I look at the properties of my email address: (my.name@abcd.efgh.company.com)
C - Just the end portion of the SMTP properties: (abcd.efgh.company.com)
D - My email address (my.name@company.com)

I don't know what to enter, or what is giving me such a generic error message.

View 7 Replies View Related

How Do I Mail Results From A Query To A Mail Recipient

Sep 12, 2002

i have to create a scheduled task that does the following:

a) creates an Excel Spreadsheet from a SQL Query

b) sends the spreadsheet to a user

i then need to schedule this task so that it runs every day and creates a NEW spreadsheet (doesnt matter it the name is the same as long as it overwrite what is already there)

HELP me PLEASE i dont like this SQL Game anymore !!

Daniel.:mad: :confused:

View 5 Replies View Related

Invalid Length Parameter ....

Jun 13, 2003

I have a ##temp table which collects command (varchar(120)) info from sysjobsteps table as follows:
command
------------------------------
BACKUP DATABASE FDMS_11111_2 To Backup_11111_2_4Thu with init, name = 'Backup of Job_11111_2_4Thu'

Now, I need to extract the database name from the command string: It did return the correct database name but ended with error message.

select substring(command, 17, charindex(' To Backup_',Command)-17) from ##tempServerNameDatabaseNameJobHistory

Command
-------
FDMS_11111_2
FDMS_9999_2
(2 row(s) affected)

Server: Msg 536, Level 16, State 3, Line 1 Invalid length parameter passed to the substring function.

-D

View 2 Replies View Related

Invalid Parameter Binding(s)--Please Help

Apr 6, 2006

I am real new to SQL Server. We are using SQL Server 2000.

My objective is to get a list of all store procedures for specific database. To accomplish this, I programmatically create a connection to the 'master' database where the sp resides, create a callablestatment for 'sp_stored_procedures' ({call sp_stored_procedures(?,?,?)}). I am passing in null, null, and the database name. When I execute the query, I get the below error:


Code:


java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid parameter binding(s).
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)



When I made the connection to the master database, I used one of the existing users from the master database.

I looked at the store procedure and verified the sp has 3 input parameter. The first two can be null.

I am not sure why I can not run this sp. I am wondering if we have the database setup properly. Any help or suggestions would be well worth it at this point.


Thanks in advance for reading my post.

Russ

View 2 Replies View Related

Invalid Reconciler Parameter

Jan 5, 2007

First of all... thanks for a great and interesting product... this is really nice...

I'm working with a winform app and pushing it out via click-once deployment (using the bootstrapper for SQLCompact as well)... the SQL install is fine, however when my app attempts to do anything with the db, i get an error "invalid reconciler parameter" error... some searching seems to indicate that this could be coming from the path being longer than 128chars... howeve, using click once, i'm not certain I can control the deployment location... I'm certain that there is a work around, but not sure what it is... any guidance?

As a note, running the app on the same machine using the output from VS (not installed via ClickOnce but simply running hte exe) works fine...

Thanks,



Rob

View 4 Replies View Related

INVALID LENGTH PARAMETER PASSED....

Jun 4, 2007

I have the follwoing stored procedure:ALTER procedure [dbo].[up_GetExecutionContext](@ExecutionGUID int = null) asbeginset nocount ondeclare@s varchar(500)declare @i intset @s = ''select @s = @s + EventType + ','-- Dynamically build the list ofeventsfrom(select distinct top 100 percent [event] as EventTypefrom dbo.PackageStepwhere (@ExecutionGUID is null or PackageStep.packagerunid =@ExecutionGUID)order by 1) as xset @i = len(@s)select case @iwhen 500 then left(@s, @i - 3) + '...'-- If string is too long thenterminate with '...'else left(@s, @i - 1) -- else just remove the final commaend as 'Context'set nocount offend --procedureGOWhen I run this and pass in a value of NULL, things work fine. When Ipass in an actual value (i.e. 15198), I get the following message:Invalid length parameter passed to the SUBSTRING function.There is no SUBSTRING being used anywhere in the query and thedatatypes look okay to me.Any suggestions would be greatly appreciated.Thanks!!

View 2 Replies View Related

Invalid Length Parameter Passed To The Substring F

Aug 13, 2007

Hi there when i tried to execute the following query in sql server

select au_fname,
SUBSTRING(P1.au_lname, CHARINDEX('/', P1.au_lname) + 1,
CHARINDEX('=', P1.au_lname, 1)-3)AS [Full Name]
from authors as P1

i will get the error like
"Invalid length parameter passed to the substring function."

If i remove -3 from there it works fine...
Please can anyone clarify this issue.

Thank You.

pavan

View 3 Replies View Related

Data-driven Subscription - Invalid Parameter?

Aug 23, 2007

Hi,

I've set up a data-driven subscription on a report but it's not sending and the error log says it's because:

Default value or value provided for the report parameter 'CSRFaxID' is not a valid value.

For the particular dataset record causing the error I'm passing the value Null to the report parameter. The report parameter CSRFaxID is set up with "Allow Null" and with a default value of Null. I can run the report in my browser with CSRFaxID set to null, but the scheduled subscription is not able to produce the report with the same parameter value. Does anyone have any idea what the problem is and how I can fix it?

Regards,

Greg McNamara

View 3 Replies View Related

Invalid Length Parameter Passed To Substring Function

Mar 3, 2014

I have a sql job which will execute the below stored proc.

Basically it Refresh the data by truncating the tables and using BCP to import the data. Job was running fine but today got a error message.

Invalid length parameter passed to the substring function. [SQLSTATE 42000] (Error 536). The step failed.

USE [database]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE Procedure [dbo].[Refresh_tables]

[Code] ......

View 2 Replies View Related

Invalid Length Parameter Passed To The SUBSTRING Function.

Feb 1, 2008

Hi,

I was trying to execute the following query.

select substring(ISNULL(CAST(FullAdress AS NVARCHAR(MAX)),''),1,charindex(',',ISNULL(CAST(FullAdress AS NVARCHAR(MAX)),''))-1) from tbl_lrf_company_details_with_codes


but i am getting the error as "Invalid length parameter passed to the SUBSTRING function."
Please advice
Thanks In advance

View 4 Replies View Related

Invalid Length Parameter Passed To The SUBSTRING Function

May 27, 2008



SELECT

C.Description,

SUBSTRING (

(CONVERT (VARCHAR (255), D.CurrentXmlValue)), --expression

(CHARINDEX ('>', CONVERT (VARCHAR (255), D.CurrentXmlValue)) + 1), --start

( (LEN (CONVERT (VARCHAR (255), D.CurrentXmlValue))) -

(CHARINDEX ('>', CONVERT (VARCHAR (255), D.CurrentXmlValue))*2) - 1

)--length

) AS Version

FROM

:
:
WHERE
:
:
This does not work while

:
:

--SUBSTRING (

(CONVERT (VARCHAR (255), D.CurrentXmlValue)) as expression, --expression

(CHARINDEX ('>', CONVERT (VARCHAR (255), D.CurrentXmlValue)) + 1) as start, --start

( (LEN (CONVERT (VARCHAR (255), D.CurrentXmlValue))) -

(CHARINDEX ('>', CONVERT (VARCHAR (255), D.CurrentXmlValue))*2) - 1

) as length --length

--) AS Version

:
:

works!!
I get

Msg 536, Level 16, State 5, Line 2

Invalid length parameter passed to the SUBSTRING function.
Error.
Any idea why i am getting this??
I am trying to get rid of xml tags in the column.

Thanks,

View 4 Replies View Related

Transact SQL :: Invalid Length Parameter Passed To Left Or Substring

Dec 1, 2015

is it possible to identify which value is causing me the above  error message and how to resolve it,These are for British postcodes.

create table #tmp (postcode varchar(200) NULL)
insert into #tmp values ('NULL')
insert into #tmp values ('-')
insert into #tmp values ('.')
insert into #tmp values ('0L6 7TP')
insert into #tmp values ('AB10 1WP')
insert into #tmp values ('AB51 5HH')

[code]...

This is the main query

select postcode,LEFT([Postcode], CHARINDEX(' ',[Postcode]) - 1)
from #tmp
order by Postcode
drop table #tmp

View 4 Replies View Related

Sql 2005 ... Invalid Length Parameter Passed To The SUBSTRING Function.

Oct 9, 2006

Hi,
I am new at sql 2000 and 2005, I have created a package in 2005 which I am trying to execute on a daily bases by creating a job. At first because of security issues the job would not execute. Hence, I had to create a credential and a proxy to run the job with sa account. Now it is giving me this error,
€œSQLServer Error: 536, Invalid length parameter passed to the SUBSTRING function. €œ
Through research I have no clue as what I need to do, or where to look.
The package runs without error when I execute the package itself.
Any help is greatly appreciated.
Thanks,
Lori

View 1 Replies View Related

Sending E-mail Using @UserName Parameter

Oct 14, 2006

I am creating a membership site. I’d like to be able to have members be able to send customized e-mail to their own individual e-mail list. In creating the mail function (at least just a simplified version so I can get the basics to work), I’m using a select statement that uses @UserName as a parameter in the WHERE clause. I can’t get this work, however, and one of the error messages I get says “must declare the scalar variable '@UserName'". Below is the code I’ve come up with, which may be far off. I'm new to programming so please keep that in mind. I’m using Visual Studio 2005 and SQL Server 2005. If anyone has any suggestions, I’d really appreciate it! Thank you.Imports System.Net.MailImports System.Data.SqlClientImports System.Web.UI.WebControlsImports System.WebPartial Class emailInherits System.Web.UI.PageProtected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.ClickDim MyEmail = New MailMessageDim MyClient = New SmtpClient("localhost")Dim FromAddress = New MailAddress(Profile.Email)MyEmail.From = FromAddress'-- Create MailAddresses from a database'-- Open a database connectionDim DBConnection = New SqlConnection( _"Server=localhost; Integrated Security=True; database=WebSite18database")DBConnection.Open()Dim SQLString As StringDim SelectParameters = New Data.SqlClient.SqlParameter("@UserName", Data.SqlDbType.VarChar)SQLString = "SELECT [UserName], [ClientFirstName], [ClientLastName], [CleintEmail], [ClientID] FROM [Clients] WHERE ([UserName] = @UserName)"Dim DBCommand = New Data.SqlClient.SqlCommand(SQLString, DBConnection)'-- Retrieve a recordset of selected records from the databaseDim DBReader As SqlDataReader = DBCommand.ExecuteReader()While DBReader.Read()Dim ToAddress = New MailAddress(DBReader("ClientEmail"))MyEmail.To.Add(ToAddress)End WhileDBReader.Close()DBConnection.Close()MyClient.Send(MyEmail)End SubEnd Class

View 2 Replies View Related

Transact SQL :: Invalid Length Parameter Passed To LEFT Or SUB-STRING Function

Jul 22, 2015

when I am trying to perform below query,
 
  INSERT INTO EMPLOYEE
    SELECT TOP 100 *
 FROM EMPLOYEE_LANDING;

I am getting Invalid length parameter passed to the LEFT or SUBSTRING function.

View 3 Replies View Related

Reporting Services :: SSRS 2008 Report Invalid Parameter Warning Not Clearing Out

Jul 16, 2015

I am using SSRS 2008 and the reports we have use parameters of type Date/Time.  The reports work well when the parameter values are entered correctly.

When entering an invalid date format for one of the Date/Time parameters the following error is displayed "The value provided for the report '<parameter name>' is not valid for its type. (rsReportParameterTypeMismatch).  This seems to be working correctly as well.  However, when the correct date format is then entered for the report parameter for which the report threw an error, the error persists and the report doesn't run again.  Setting the parameter to "NULL" doesn't work either.

The only way to get the report to run again is to refresh the entire report.  Of course, if at that point one has entered a bunch of other parameter values, those values all disappear.

View 2 Replies View Related







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