---
title: "ADO.NET Insert Mysql, All data is null"  
description: "ADO.NET Insert Mysql, All data is null"  
author: "Kate Smith"  
published: 2013-06-19  
updated: 2013-06-19  
canonical: https://www.mindstick.com/forum/1211/ado-dot-net-insert-mysql-all-data-is-null  
category: "ado.net"  
tags: ["ado.net"]  
reading_time: 1 minute  

---

# ADO.NET Insert Mysql, All data is null

Hi [Developers](https://www.mindstick.com/articles/12875/blunders-you-must-avoid-while-hiring-java-developers-to-get-the-best-fulfilling-your-needs), \
I have created a winform [application](https://www.mindstick.com/articles/12824/calculator-application-in-android), and use [ado.net](https://www.mindstick.com/articles/804/connection-pooling-in-ado-dot-net) to access [mysql database](https://answers.mindstick.com/qa/38302/what-is-the-main-difference-between-innodb-myisam-mysql-database-engines). But I encountered a strange problem.\
my data table create script:\
**[create table](https://www.mindstick.com/articles/443/how-to-create-table-in-sql-server) using_user {** **`id` int(11) [NOT NULL](https://www.mindstick.com/interview/1933/what-is-not-null-constraint) auto_increment,** **'dx_ip_addr' default NULL,** **'scard_type' default NULL,** **....****}**\
my [c# code](https://www.mindstick.com/forum/403/how-to-export-data-in-excel-file-from-sql-server-using-c-sharp-code):\
**MySqlConnection conn = new MySqlConnection();****conn.ConnectionString = "Server=localhost; Port=9999; Uid=root; Pwd=ecsc; Database=zhz-netbar-jk;"****\****conn.Open();****\****MySqlCommand cmd = conn.CreateCommand();****cmd.CommandText = "insert into using_user (dx_ip_addr, scard_type,...)values(@dx_ip_addr, @scard_type,...)";****\****cmd.Parameters.Add(new MySqlParameter("@dx_ip_addr", "5000230001"));****cmd.Parameters.Add(new MySqlParameter("@scard_type", "1"));****...****\****cmd.ExecuteNonQuery();****\****conn.Close();**\
After do this, the [primary key](https://www.mindstick.com/blog/214/primary-key) 'id' was generated, but other fields are NULL. How can I [resolve this problem](https://answers.mindstick.com/qa/94690/why-does-it-take-google-chrome-so-long-to-open-in-my-computer-what-should-i-do-now-to-resolve-this-problem)?

## Replies

### Reply by Sumit Kesarwani

Hi,\
You have a problem on your table structure where you don't have specified what datatype you will use on the other fields\
**create table using_user {** **`id` int(11) NOT NULL auto_increment,** **'dx_ip_addr' default NULL, <--- no data type specified** **'scard_type' default NULL, <--- no data type specified** **....****}**Try\
**create table using_user {** **`id` int(11) NOT NULL auto_increment,** **'dx_ip_addr' int,** **'scard_type' int,** **....** **}**\


---

Original Source: https://www.mindstick.com/forum/1211/ado-dot-net-insert-mysql-all-data-is-null

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
