Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to vb.net pass the byte() in StoredProcedure?
Message
De
04/01/2011 22:33:47
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
How to vb.net pass the byte() in StoredProcedure?
Versions des environnements
Environment:
VB 9.0
OS:
Windows XP
Database:
MS SQL Server
Divers
Thread ID:
01494733
Message ID:
01494733
Vues:
148
In my case, because i want to do the login page, my table is login(id nvarchar(20), password varbinary(max))
in first , i have already  result  (encryptByte As Byte()  and  hex ) 
           
            Dim encryptByte As Byte() = sqlCmd.ExecuteScalar()
            Dim hex As String = "0x" + BitConverter.ToString(encryptByte).Replace("-", "")

But question is coming, i have StoredProcedure sp_insertLogin... in part 2,
@valueVarbinary < must pass the varbinary, and table field "password" also varbinary that is ok 
But in the first  's result encryptByte(0)> 0 , encryptByte(1)> 0,encryptByte(2)> 0,encryptByte(3)> 123 ....last one is encryptbyte(35)...>197..

           Dim insertLoginCmd As New SqlClient.SqlCommand("sp_insertLogin", cn)
                    insertLoginCmd.CommandType = CommandType.StoredProcedure
                    insertLoginCmd.Parameters.Add("@tablename", SqlDbType.NVarChar).Value = "Login"
                    Dim objinserKeytParameter As SqlParameter = New SqlParameter("@pKey", SqlDbType.NVarChar, 20)
                    insertLoginCmd.Parameters.Add(objinserKeytParameter)
                    objinserKeytParameter.Value = txtid.Text

                    Dim objinsertParameter As SqlParameter = New SqlParameter("@valueVarbinary", SqlDbType.varBinary)
                    insertLoginCmd.Parameters.Add(objinsertParameter)
                    objinsertParameter.Value = encryptByte          '????????My problem in here, if i pass encryptByte the result only take the 0x0 < i feel encryptByte(0), can't take all byte array , if i pass the hex  < error because string , how can i do ???????????????????????????
                    insertLoginCmd.ExecuteNonQuery()
Répondre
Fil
Voir

Click here to load this message in the networking platform