Wednesday, 7 March 2012
Confused By Error Msg
get two parameters returned. The input parameter is an integer, one of the
output parameters is also and integer and the other output parameter is an
nvarchar. When I run the execute command I get an error:
Implicit conversion from data type sql_variant to nvarchar is not allowed.
Use the CONVERT function to run this query.
I have no idea where the sql_variant type comes from? Any thoughts?
Here is the portion of my code that makes the call followed by the SP code.
========================================
=========
Dim cmd4 As New OleDb.OleDbCommand("GetAdClicks", CommonClass.myConn)
cmd4.CommandType = CommandType.StoredProcedure
cmd4.Parameters.Add("@.id", SqlDbType.Int)
cmd4.Parameters("@.id").Value = Request.Params("ID")
cmd4.Parameters.Add("@.clickcount", SqlDbType.Int)
cmd4.Parameters("@.clickcount").Direction = ParameterDirection.Output
cmd4.Parameters.Add("@.url", SqlDbType.NVarChar, 100)
cmd4.Parameters("@.url").Direction = ParameterDirection.Output
cmd4.ExecuteNonQuery()
=========== SP Code ====================
ALTER Procedure GetAdClicks
(
@.id int,
@.clickcount int OUTPUT,
@.url nvarchar(100) OUTPUT
)
AS
SELECT @.clickcount = clickcount, @.url=url
FROM adserver
WHERE id=@.idWayne,
What is the data type for the URL column in the adserver table?
EXEC SP_COLUMNS AUTHORS
HTH
Jerry
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:%23%23Zm2BP2FHA.2440@.TK2MSFTNGP10.phx.gbl...
>I am using a VB aspx page to pass a parameter to a stored procedure and to
>get two parameters returned. The input parameter is an integer, one of the
>output parameters is also and integer and the other output parameter is an
>nvarchar. When I run the execute command I get an error:
> Implicit conversion from data type sql_variant to nvarchar is not allowed.
> Use the CONVERT function to run this query.
> I have no idea where the sql_variant type comes from? Any thoughts?
> Here is the portion of my code that makes the call followed by the SP
> code.
> ========================================
=========
> Dim cmd4 As New OleDb.OleDbCommand("GetAdClicks", CommonClass.myConn)
> cmd4.CommandType = CommandType.StoredProcedure
> cmd4.Parameters.Add("@.id", SqlDbType.Int)
> cmd4.Parameters("@.id").Value = Request.Params("ID")
> cmd4.Parameters.Add("@.clickcount", SqlDbType.Int)
> cmd4.Parameters("@.clickcount").Direction = ParameterDirection.Output
> cmd4.Parameters.Add("@.url", SqlDbType.NVarChar, 100)
> cmd4.Parameters("@.url").Direction = ParameterDirection.Output
> cmd4.ExecuteNonQuery()
>
> =========== SP Code ====================
> ALTER Procedure GetAdClicks
> (
> @.id int,
> @.clickcount int OUTPUT,
> @.url nvarchar(100) OUTPUT
> )
> AS
> SELECT @.clickcount = clickcount, @.url=url
> FROM adserver
> WHERE id=@.id
>
>|||It is nvarchar
Wayne
"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:uj3rHFP2FHA.3788@.tk2msftngp13.phx.gbl...
> Wayne,
> What is the data type for the URL column in the adserver table?
> EXEC SP_COLUMNS AUTHORS
> HTH
> Jerry
>
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:%23%23Zm2BP2FHA.2440@.TK2MSFTNGP10.phx.gbl...
>|||Wayne,
What happens if you run the sproc from Query Analyzer?
HTH
Jerry
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:OEExaLP2FHA.3448@.TK2MSFTNGP10.phx.gbl...
> It is nvarchar
> Wayne
> "Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
> news:uj3rHFP2FHA.3788@.tk2msftngp13.phx.gbl...
>|||Jerry;
When I run it from QA everything seems fine, I get the count as a number and
the url is a string
Wayne
"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:uXH7iPP2FHA.3108@.tk2msftngp13.phx.gbl...
> Wayne,
> What happens if you run the sproc from Query Analyzer?
> HTH
> Jerry
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:OEExaLP2FHA.3448@.TK2MSFTNGP10.phx.gbl...
>|||Wayne,
Ok...that probably removes SQL as the cause. Might want to follow this up
with a programming NG for the programming language you're using.
HTH
Jerry
"Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
news:%23XKQHtP2FHA.3108@.tk2msftngp13.phx.gbl...
> Jerry;
> When I run it from QA everything seems fine, I get the count as a number
> and the url is a string
> Wayne
> "Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
> news:uXH7iPP2FHA.3108@.tk2msftngp13.phx.gbl...
>|||OK - will do.
Thanks for the help.
Wayne
"Jerry Spivey" <jspivey@.vestas-awt.com> wrote in message
news:upfzonY2FHA.3416@.tk2msftngp13.phx.gbl...
> Wayne,
> Ok...that probably removes SQL as the cause. Might want to follow this up
> with a programming NG for the programming language you're using.
> HTH
> Jerry
> "Wayne Wengert" <wayneSKIPSPAM@.wengert.org> wrote in message
> news:%23XKQHtP2FHA.3108@.tk2msftngp13.phx.gbl...
>
Friday, 17 February 2012
Configuring SQL Express -- getting login failed exception
I have a machine with Windows XP Pro w/SP 2, IIS, SQL Server Express and Visual Studio 2005 installed. When I attempt to open a database from an ASPX page, I'm getting an exception with the message:
"Cannot open database "Tasks" requested by the login. The login failed.
Login failed for user 'MYDEV\ASPNET'."
I've searched the web and found a number of pages that talk about the "Login failed for MACHINE\ASPNET" issue, but I didn't find any with a solution.
For your information (in case it makes any difference), the computer is connected to a domain. And the authentication methods for the virtual directory (in IIS) is configured for "Anonymous access" and "Integrated Windows authentication."
Does anyone know how to configure SQL Server Express (or is it IIS?) so the web page can access the database?
RichardR
Okay, I found a solution.
For anyone else experiencing this problem, here's what I did:
First, I installed the November CTP of SQL Server Management Studio Express.
Then, I added the account MACHINENAME\ASPNET under Security | Logins. I did a right-mouse click on the ASPNET login name and clicked on Properties.
This brought up the Login Properties page for ASPNET. I mapped the ASPNET account to my database selecting the database in the "Default Database" dropdown.
In order for the stored procedures to execute, I also needed to check the db_owner box under the Mappings tab.
Finally, I needed to change the connection string to:
Data Source=MYDEV\SQLEXPRESS;Connect Timeout=30;User Instance=False;initial catalog=Tasks;Integrated Security=SSPI;Persist Security Info=False
Hope this helps anyone else encountering this problem.
Richard
|||Thanks - that was very helpful!!!|||Thanks for the post! Saved my life after hours of searching!!!
Configuring SQL Express -- getting login failed exception
I have a machine with Windows XP Pro w/SP 2, IIS, SQL Server Express and Visual Studio 2005 installed. When I attempt to open a database from an ASPX page, I'm getting an exception with the message:
"Cannot open database "Tasks" requested by the login. The login failed.
Login failed for user 'MYDEV\ASPNET'."
I've searched the web and found a number of pages that talk about the "Login failed for MACHINE\ASPNET" issue, but I didn't find any with a solution.
For your information (in case it makes any difference), the computer is connected to a domain. And the authentication methods for the virtual directory (in IIS) is configured for "Anonymous access" and "Integrated Windows authentication."
Does anyone know how to configure SQL Server Express (or is it IIS?) so the web page can access the database?
RichardR
Okay, I found a solution.
For anyone else experiencing this problem, here's what I did:
First, I installed the November CTP of SQL Server Management Studio Express.
Then, I added the account MACHINENAME\ASPNET under Security | Logins. I did a right-mouse click on the ASPNET login name and clicked on Properties.
This brought up the Login Properties page for ASPNET. I mapped the ASPNET account to my database selecting the database in the "Default Database" dropdown.
In order for the stored procedures to execute, I also needed to check the db_owner box under the Mappings tab.
Finally, I needed to change the connection string to:
Data Source=MYDEV\SQLEXPRESS;Connect Timeout=30;User Instance=False;initial catalog=Tasks;Integrated Security=SSPI;Persist Security Info=False
Hope this helps anyone else encountering this problem.
Richard
|||Thanks - that was very helpful!!!|||Thanks for the post! Saved my life after hours of searching!!!
Configuring SQL Express -- getting login failed exception
I have a machine with Windows XP Pro w/SP 2, IIS, SQL Server Express and Visual Studio 2005 installed. When I attempt to open a database from an ASPX page, I'm getting an exception with the message:
"Cannot open database "Tasks" requested by the login. The login failed.
Login failed for user 'MYDEV\ASPNET'."
I've searched the web and found a number of pages that talk about the "Login failed for MACHINE\ASPNET" issue, but I didn't find any with a solution.
For your information (in case it makes any difference), the computer is connected to a domain. And the authentication methods for the virtual directory (in IIS) is configured for "Anonymous access" and "Integrated Windows authentication."
Does anyone know how to configure SQL Server Express (or is it IIS?) so the web page can access the database?
RichardR
Okay, I found a solution.
For anyone else experiencing this problem, here's what I did:
First, I installed the November CTP of SQL Server Management Studio Express.
Then, I added the account MACHINENAME\ASPNET under Security | Logins. I did a right-mouse click on the ASPNET login name and clicked on Properties.
This brought up the Login Properties page for ASPNET. I mapped the ASPNET account to my database selecting the database in the "Default Database" dropdown.
In order for the stored procedures to execute, I also needed to check the db_owner box under the Mappings tab.
Finally, I needed to change the connection string to:
Data Source=MYDEV\SQLEXPRESS;Connect Timeout=30;User Instance=False;initial catalog=Tasks;Integrated Security=SSPI;Persist Security Info=False
Hope this helps anyone else encountering this problem.
Richard
|||Thanks - that was very helpful!!!|||Thanks for the post! Saved my life after hours of searching!!!Tuesday, 14 February 2012
Configuring SIS in a Cluster problem
instructions found at http://msdn2.microsoft.com/en-us/library/ms345193.aspx.
I have added the required dependancies to a new generic resource in
the Cluster Adminstration screen and it is now asking me for DHCP
Service Parameters such as Database Path; Audit File Path, Backup
Path. These are not discussed in the instructions in the instructions
and I can't find any info on this page. Can anyone advise what
information the wizard is looking for here?
My SysAdmin tells me we are getting DHCP from Novel, if that helps.
On Dec 10, 10:11 am, Fayven Wren <FayvenW...@.gmail.com> wrote:
> I am attempting to configure SIS in a clustered environment using the
> instructions found athttp://msdn2.microsoft.com/en-us/library/ms345193.aspx.
> I have added the required dependancies to a new generic resource in
> the Cluster Adminstration screen and it is now asking me for DHCP
> Service Parameters such as Database Path; Audit File Path, Backup
> Path. These are not discussed in the instructions in the instructions
> and I can't find any info on this page. Can anyone advise what
> information the wizard is looking for here?
> My SysAdmin tells me we are getting DHCP from Novel, if that helps.
My Bad. Misread the instructions and did not specify the Service Type
as "Generic Service".