473,396 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Array of bytes to/from MySql

Hi,

I need to store a array() of byte to a mysql field. I created a field in
mysql of type varbinary. But storing and retrieving gives problems.

Please help.

The
strTemp = EnDeCrypt(txt, psw)

Label1.Text = strTemp

encData = System.Text.Encoding.UTF8.GetBytes(strTemp)

Dim myconnstring As String = "host=vmge1; "

Dim conn As New MySql.Data.MySqlClient.MySqlConnection

Dim cmd As New MySql.Data.MySqlClient.MySqlCommand

Dim myDataReader As MySql.data.mysqlclient.MySqlDataReader

Dim oParameter As New MySql.Data.MySqlClient.MySqlParameter

conn.ConnectionString = myconnstring

Dim strQuery As String = "UPDATE klanten SET secret=?ArrayParameter"

Try

conn.Open()

cmd.Connection = conn

cmd.CommandType = CommandType.Text

cmd.CommandText = strQuery

oParameter.ParameterName = "?ArrayParameter"

oParameter.DbType = DbType.Binary

oParameter.Value = strTemp

Label1.Text = strTemp

cmd.Parameters.Add(oParameter)

cmd.ExecuteNonQuery()

Catch ex As MySql.Data.MySqlClient.MySqlException

Label1.Text = "Error " & ex.Number & " " & ex.Message

End Try

Dim strQuery2 As String = "SELECT secret from klanten"

cmd.CommandText = strQuery2

myDataReader = cmd.ExecuteReader()

If myDataReader.Read Then

Dim T As String = myDataReader.GetString(0)

Label2.Text = T

End If

If Label1.Text = Label2.Text Then Label3.Text = "GELIJK" Else Label3.Text =
"ONGELIJK"

Nov 19 '05 #1
0 1095

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: siliconmike | last post by:
Hello, I'd like to implement a large 2-d array 2d array size: 5000 x 5000 each element: int 4 bytes type: static, MYISAM how is this done in MySQL? I'm a newbie, so details will help. Mike
0
by: Gert | last post by:
Hi, I need to store a array() of byte to a mysql field. I created a field in mysql of type varbinary. But storing and retrieving gives problems. Please help. The strTemp = EnDeCrypt(txt,...
6
by: bill | last post by:
I am about to start on a module that will accept a location from a user, use Google geolocation services to get the lat/lon and then compute the distance from the site visitor to about 100 kennels...
2
by: O.B. | last post by:
When using Marshal to copy data from a byte array to the structure below, only the first byte of the "other" array is getting copied from the original byte array. What do I need to specify to get...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.