473,809 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question About MySQL and .NET

Hi all, writing a VB.NET app using the MySqlConnection client and having a
hard time with MySqlCommand Parameter queries. I create a query like this:
cmd.CommandText = "INSERT INTO Location_Lookup (Description, ID) VALUES
(@desc, @id)"
cmd.Parameters. Add("@desc", MySqlDbType.Var Char, 128).Value = val
cmd.Parameters. Add("@id", MySqlDbType.Int 32).Value = seedid
cmd.ExecuteNonQ uery()

I keep getting the following error mesasge: Column 'Description' cannot be
null

I've verified the values of the val ("Armenia") and seedid (10) variables.
Neither is null. I've also verified the two MySqlParameters added to the
MySqlCommand.

Can anyone offer a solution or point me in the right direction to find MySQL
sample code for the .NET connector?

TIA


Jul 23 '05 #1
1 1156
Never mind, I think I solved the problem. Instead of the @ sign, it looks
like parameter names are preceded with ?.

Thanks

"Michael C#" <xy*@abcdef.com > wrote in message
news:fo******** *********@fe08. lga...
Hi all, writing a VB.NET app using the MySqlConnection client and having a
hard time with MySqlCommand Parameter queries. I create a query like
this:
cmd.CommandText = "INSERT INTO Location_Lookup (Description, ID) VALUES
(@desc, @id)"
cmd.Parameters. Add("@desc", MySqlDbType.Var Char, 128).Value = val
cmd.Parameters. Add("@id", MySqlDbType.Int 32).Value = seedid
cmd.ExecuteNonQ uery()

I keep getting the following error mesasge: Column 'Description' cannot
be null

I've verified the values of the val ("Armenia") and seedid (10) variables.
Neither is null. I've also verified the two MySqlParameters added to the
MySqlCommand.

Can anyone offer a solution or point me in the right direction to find
MySQL sample code for the .NET connector?

TIA


Jul 23 '05 #2

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

Similar topics

2
1635
by: j-marvin | last post by:
hi- i have a book on mysql written for version 4 that has hard to read screen shots. i'd like to get a newer mysql book. do i have to worry about the version number of mysql i am using if i use php 4.3 version or newer? i'd like to get the osbourne mysql book. the only thought that comes to mind is some things may be deprecated since the php 4.2 book i own was published. i ought to be able to use the net and my new mysql book to...
0
2319
by: MJL | last post by:
This is a mysql/php question (but a little more on the mysql side.) The two are so closely related these days, I thought it would be ok to ask here. I installed on my Suse Linux system mysql 4.0 using an rpm. I also installed all of the appropriate PHP 4.3 and Apache 2.0 rpms. I set my socket path in my.cnf to /tmp/mysql.sock. I then, just to be safe and thorough, copied this my.cnf to ~/.my.cnf and to the /var/lib/mysql directory...
8
4491
by: Tony Clarke | last post by:
Hi, Just a quick question about performance with MySQL & PHP. If I had a table in a MySQL database with about 100,000 records in it and I need to find the last record is there a quick way to do this, other than going through the whole database to find the last record? Would the amount of records in the table cause major performance problems? For example, if I had a html form that people used to log something and needed to display a...
0
2975
by: Ben Margolin | last post by:
I am new to subselects, and what I really want is to do them in an update, but the following shows a simpler select, that also doesn't seem to work as I think it should. Advice? Do I just misunderstand how subselects are actually executed? (This is on mysql version 4.1.0-alpha-max-nt.) First, here's the tables in question: mysql> describe m;
0
2028
by: Charles Cantrell | last post by:
I have recently set up mySQL on a Mandrake release of Linux (Version 7 of Mandrake, I believe), using the binary 4.0.13 standard release. The set up and start up all were normal, as far as I could tell, with no warnings or error messages. In nearly all respects, the database appears to be running as expected. I have the book "PHP and mySQL Web Development" by Luke Welling and Laura Thomson, and have been working through the examples...
5
3847
by: jayson_13 | last post by:
Hi, I need to implement a counter and i face problem of locking so hope that u guys can help me. I try to do test like this : 1st connection SELECT * FROM nextkey WHERE tblname = 'PLCN' FOR Update; (when i execute this statement and i guess that this will lock the
2
1563
by: kimshapiro100 | last post by:
Question on PhP, MySQL I am thinking of a consumer internet business for which I will have to have a database driven site built. I am thinking of using PhP, MySQL as the main technologies amd Linux hosting( and some Dreamweaver). My question is:
18
3165
by: Frances | last post by:
I want to learn PHP.. I know JSP, Servlets, have been using Tomcat for 2 years now, and even though I know there are ways you can use PHP in conjunction with Tomcat, I'd rather not tinker with Tomcat.. I think I'd rather try to do it straight 'from scratch'... following instructions here, http://us2.php.net/tut.php.. so you need both Apache **AND** PHP server? not sure what to dl when get to http://www.apache.org/ (HTTP Server? top...
2
1763
by: redefined.horizons | last post by:
I'd like to introduce myself to the group. I am currently researching the use of MySQL as a database backend for AutoCAD Map 3D. I will hopefully be doing some work with geospatial data in MySQL. I tried a post or two on the MySQL forums, but didn't get much of a response. I'm hoping I'll do better on this group. :] Is there a place to discuss the development of MySQL? I will keep the group posted on my progress with MySQL, and will
1
1534
by: rockdale | last post by:
Well, I guess I did express myself very clearly. I implemented the Ent Lib 2.0 data block against SQL database successfully. The system now is a production system. But now we want to migrate the database to MySQL. From mySQL website you can find Connector/Net 1.0 and COnnector/ODBC, further more this link talks aboout http://dev.mysql.com/tech-resources/articles/dotnet/index.html#ADO.NET different approaches to connect to mySQL. My...
0
9721
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10640
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
10376
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9200
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
6881
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
5550
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
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
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
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.