473,654 Members | 3,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to store and retrieve array of bytes 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.Enc oding.UTF8.GetB ytes(strTemp)

Dim myconnstring As String = "host=vmge1 ; "

Dim conn As New MySql.Data.MySq lClient.MySqlCo nnection

Dim cmd As New MySql.Data.MySq lClient.MySqlCo mmand

Dim myDataReader As MySql.data.mysq lclient.MySqlDa taReader

Dim oParameter As New MySql.Data.MySq lClient.MySqlPa rameter

conn.Connection String = myconnstring

Dim strQuery As String = "UPDATE klanten SET secret=?ArrayPa rameter"

Try

conn.Open()

cmd.Connection = conn

cmd.CommandType = CommandType.Tex t

cmd.CommandText = strQuery

oParameter.Para meterName = "?ArrayParamete r"

oParameter.DbTy pe = DbType.Binary

oParameter.Valu e = strTemp

Label1.Text = strTemp

cmd.Parameters. Add(oParameter)

cmd.ExecuteNonQ uery()

Catch ex As MySql.Data.MySq lClient.MySqlEx ception

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

End Try

Dim strQuery2 As String = "SELECT secret from klanten"

cmd.CommandText = strQuery2

myDataReader = cmd.ExecuteRead er()

If myDataReader.Re ad Then

Dim T As String = myDataReader.Ge tString(0)

Label2.Text = T

End If

If Label1.Text = Label2.Text Then Label3.Text = "GELIJK" Else Label3.Text =
"ONGELIJK"
Nov 19 '05 #1
0 1458

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

Similar topics

2
3741
by: forums_mp | last post by:
I've got an STL class (see below) with two functions to store and retrieve data - msg structs. The "Store" function when called will copy the received message (depending on which message) into the appropriate array. For instance if I receive a RCVD_MSG1, I'll copy into msg1 . Upon receipt of the next RCVD_MSG1. I'll copy into msg1 . The Retrieve function when called should retrieve the latest copy. ie. msg1 or msg1 .
0
1709
by: Andy Jackman | last post by:
Hi, I'm new to mySql. I've got a table with an integer field defined like this: l_start_wait int(9) not null I inserted a value into the table using mysql command line client with: Insert into tbl_wait_list values(12345678); When I use mysql_fetch_row() to retrieve the column values I am surprised to see that mysql_fetch_lengths() returns a length of 8 rather than 4 and
3
8578
by: jacob nikom | last post by:
Hi, I would like to be able to store numerical array in MySQL. I am really looking for the solution to store it in the one field only. For example, I have a matrix, which I want to store in the table, but I don't want to create one column per matrix element - too many columns or matrix size could change easily. Should I convert all elements from numerical type into string and
12
7710
by: jacob nikom | last post by:
Hi, I would like to store XML files in MySQL. What is the best solution: 1. Convert it to string and store it as CLOB/text 2. Serialize it and store as byte array 3. Flatten it out and create one column per element, each column is VARCHAR Does MySQL has anything special for XML data? Is there any software which helps to store XML data in MySQL
5
2927
by: Roy Gourgi | last post by:
Hi, I am used to working in Visual FoxPro and I would like to be able to create a database and store and retrieve information from it. What is the simplest way to do it and what should I be using as there are many choices to choose from. My database will contain a lot of records. TIA
5
3367
by: lawrence k | last post by:
I'm a little weak on my basic I/O. Help me out please. Is it right to say that I can just open any file with file(), get it as a string, and then store in a MySql database, in, say, a MediumText field? I realize that MySql supports binary fields, but my current MySql schema does not have any binary fields, and I'm wondering if I can store the file without changing my current schema. Can I recreate the file later, if I wish, just be...
11
3448
by: mwebel | last post by:
Hi, i had this problem before (posted here and solved it then) now i have the same problem but more complicated and general... basically i want to store the adress of a istream in a char* among other pieces of information information and retrieve it later... like this: *********************** //supossing i have a istream
6
3113
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 (could grow to 1000 eventually). Once I have the distance I need to sort the kennels by distance and present those within 500 miles. Approach 1: read the kennel lat/lon from the mysql kennel record compute the distance
3
3618
by: JM | last post by:
Before storing information from a form in database I perform follwing operations on it : $path = mysql_real_escape_string(strip_tags(trim(urldecode($_POST)))); $summary = mysql_real_escape_string(strip_tags(trim(urldecode($_POST)))) When I look in database I see '\r\n' in the text for the summary wherever I pressed return-key. When i retrieve the information from database and display it on webpage
0
8296
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8816
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8598
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7310
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4299
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2721
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1928
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.