Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encrypted String - Newbie question
Message
From
06/11/2007 10:08:16
 
 
To
06/11/2007 09:55:05
General information
Forum:
ASP.NET
Category:
ADO.NET
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Miscellaneous
Thread ID:
01266932
Message ID:
01266976
Views:
8
Yes I am sure, If I use an ASP.Net TableAdapter I can trace the code parameter by parameter and it blows on this one. I guess I could test with this parameter disabled to verify though. The parameter definition in the SP is :
ALTER PROCEDURE [dbo].[SaveSale] 
	-- Add the parameters for the stored procedure here
	@userguid uniqueidentifier = '6F9619FF-8B86-D011-B42D-00C04FC964FF',
	@uidshipvia integer = 0, 
	@emailaddress varchar(200) = '',
	@shipfirstname varchar(200) = '', 
	@shiplastname varchar(200) = '', 
	@shipaddr1 varchar(200) = '', 
	@shipaddr2 varchar(200) = '', 
	@shipcity varchar(200) = '', 
	@shippostalcode varchar(200) = '', 
	@shipcountry varchar(200) = '', 
	@shipphone varchar(200) = '', 
	@billfirstname varchar(200) = '', 
	@billlastname varchar(200) = '', 
	@billaddr1 varchar(200) = '', 
	@billaddr2 varchar(200) = '', 
	@billcity varchar(200) = '', 
	@billpostalcode varchar(200) = '', 
	@phoneday varchar(200) = '', 
	@phoneevening varchar(200) = '', 
	@phonefax varchar(200) = '', 
	@txtcardno varchar(150) ,
	@cid varchar(20) = '',
	@expiredate varchar(4) = '0199' , 
	@uidclient int = 0,
	@DetailString VarChar(max),
	@uid Int = -1 output 
>Hmmmm ... and you're sure that it's *that* parameter causing the problem? What *is* the length of the encryptedcc string? How is the parameter defined in the Stored Proc?
>
>~~Bonnie
>
>
>
>>This is the block.
>>
>>            Dim encryptedcc As String = oCrypto.Cipher(ccno)
>>                Dim command As SqlCommand = _
>>                    New SqlCommand("SaveSale", conn)
>>                command.CommandType = CommandType.StoredProcedure
>>                command.Parameters.AddWithValue("UserGuid", UserGuid)
>>                command.Parameters.AddWithValue("uidShipvia", idShipvia)
>>                command.Parameters.AddWithValue("emailaddress", Me.emailaddress)
>>                command.Parameters.AddWithValue("shipfirstname", Me.shipfirstname)
>>                command.Parameters.AddWithValue("shiplastname", Me.shiplastname)
>>                command.Parameters.AddWithValue("shipaddr1", Me.shipaddr1)
>>                command.Parameters.AddWithValue("shipaddr2", Me.shipaddr2)
>>                command.Parameters.AddWithValue("shipcity", Me.shipcity)
>>                command.Parameters.AddWithValue("shippostalcode", Me.shippostalcode)
>>                command.Parameters.AddWithValue("shipcountry", Me.shipcountry)
>>                command.Parameters.AddWithValue("shipphone", Me.shipphone)
>>                command.Parameters.AddWithValue("billfirstname", Me.billfirstname)
>>                command.Parameters.AddWithValue("billlastname", Me.billlastname)
>>                command.Parameters.AddWithValue("billaddr1", Me.billaddr1)
>>                command.Parameters.AddWithValue("billaddr2", Me.billaddr2)
>>                command.Parameters.AddWithValue("billcity", Me.billcity)
>>                command.Parameters.AddWithValue("billpostalcode", Me.billpostalcode)
>>                command.Parameters.AddWithValue("phoneday", Me.phoneday)
>>                command.Parameters.AddWithValue("phoneevening", Me.phoneevening)
>>                command.Parameters.AddWithValue("phonefax", Me.phonefax)
>>                command.Parameters.AddWithValue("txtcardno", encryptedcc)
>>                command.Parameters.AddWithValue("cid", ccv)
>>                command.Parameters.AddWithValue("expiredate", expdate)
>>                command.Parameters.AddWithValue("uidclient", Current.Application("CLIENTID").ToString)
>>                command.Parameters.AddWithValue("detailstring", DetailString)
>>                command.Parameters.AddWithValue("uid", 0)
>>
>>*** POW! Error occurs on the next line
>>                lOk = command.ExecuteNonQuery() >= 0
>>
>>                conn.Close()
>>
>>
>>
>>>What line of code is producing that error?
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>>Thanks Bonnie,
>>>>
>>>>That is where I started.... But when I use that technique I get "invalid substring reference" yahta yahta yahta complaints from ADO.
>>>>
>>>>Invalid length parameter passed to the SUBSTRING function
>>>>
>>>>
>>>>Glenn
>>>>
>>>>>Glenn,
>>>>>
>>>>>I think it's simply a string .NET data type and a VARCHAR() SQL data type. That's the first thing I would try anyway. <g>
>>>>>
>>>>>~~Bonnie
>>>>>
>>>>>
>>>>>
>>>>>>I am trying to store an DES3 encrypted string from a VB.Net program into a field of a SQL 2005 table using a stored procedure.
>>>>>>The final Code which returns the encrypted string is:
>>>>>>CipheredValue = Convert.ToBase64String(desdencrypt.TransformFinalBlock(buff, 0, buff.Length))
>>>>>>Return CipheredValue
>>>>>>
>>>>>>
>>>>>>My questions are:
>>>>>>
>>>>>>
  • What data type is required in SQL 2005 to store this data

  • >>>>>>
  • What datatype must I use as the parameter in the SP

  • >>>>>>
  • What data type must I use in the
    >>>>>>Command.Parameters.AddWithValue()

  • >>>>>>
  • What datatype should I use in the VB.Net program
    >>>>>>
    >>>>>>
    >>>>>>I sure could use some sage advice.
    >>>>>>
    >>>>>>Thanks
    >>>>>>
    >>>>>>Glenn
  • Previous
    Reply
    Map
    View

    Click here to load this message in the networking platform