|
 |
aspx_professional thread: GUID Trouble
Message #1 by "Aaron Fleming" <aaronf@w...> on Mon, 22 Jul 2002 16:29:26 -0400
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_00B3_01C2319E.F1033BF0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
This fixed it:
Dim IID as GUID = New System.Guid(trim(request.querystring("iid")))
af
-----Original Message-----
From: Aaron Fleming [mailto:aaronf@w...]
Sent: Monday, July 22, 2002 4:39 PM
To: ASPX_Professional
Subject: [aspx_professional] RE: GUID Trouble
Same error ....
-----Original Message-----
From: Debreceni, David [mailto:david_debreceni@r...]
Sent: Monday, July 22, 2002 4:35 PM
To: ASPX_Professional
Subject: [aspx_professional] RE: GUID Trouble
I think you will have to do this:
Dim IID as GUID = ctype(request.QueryString("iid"),GUID)
David Debreceni
Senior Visual Basic/ASP Developer
xxx-xxx-xxxx x 1086
-----Original Message-----
From: Aaron Fleming [mailto:aaronf@w...]
Sent: Monday, July 22, 2002 4:29 PM
To: ASPX_Professional
Subject: [aspx_professional] GUID Trouble
I am trying to pass a SQL GUID from a querystring into a stored
procedure with the following code:
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.SqlClient" %>
<script runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim URL as String = trim(request.querystring("URL"))
Dim IID as GUID = request.querystring("iid")
Dim ConnectionString As String = "Network
Library=DBMSSOCN;" & _
"Data Source=x;" & _
"User ID=x;" & _
"Password=x"
Dim CommandText As String = "sp_go"
Dim myConnection As New SqlConnection(ConnectionString)
Dim myCommand As New SqlCommand(CommandText, myConnection)
Dim workParam As New SqlParameter()
myCommand.CommandType = CommandType.StoredProcedure
myCommand.Parameters.Add("@IID", SqlDbType.UniqueId).Value = IID
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
response.redirect(URL)
End Sub
</script>
And am getting the following error:
Compiler Error Message: BC30311: Value of type 'String' cannot be
converted to 'System.Guid'.
Any ideas?
---
--- Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
--- Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
|
|
 |