C# MySQL insert data issue

Закрито Опубліковано %project.relative_time Оплачується при отриманні
Закрито Оплачується при отриманні

I am currently having an issue in inserting data into the MySQL database. Our code inserts null values when the form is submitted with no errors. This is the first time we are working with MySQL for the first time. We usually work with SQL Server and it works with no problems.

We need some one to look into why it is entering in null values.

Please see the script below and see if we are doing wrong.

string insertSQL;

insertSQL = "INSERT INTO vendors (";

insertSQL += "fname,";

insertSQL += "lname,";

insertSQL += "company_name,";

insertSQL += "address_1,";

insertSQL += "address_2,";

insertSQL += "city,";

insertSQL += "state_id,";

insertSQL += "postal_code,";

insertSQL += "phone,";

insertSQL += "fax,";

insertSQL += "email,";

insertSQL += "web_url,";

insertSQL += "password,";

insertSQL += "active,";

insertSQL += "status,";

insertSQL += "date_entered) ";

insertSQL += "VALUES (";

insertSQL += "@fname,";

insertSQL += "@lname,";

insertSQL += "@company_name,";

insertSQL += "@address_1,";

insertSQL += "@address_2,";

insertSQL += "@city,";

insertSQL += "@state_id,";

insertSQL += "@postal_code,";

insertSQL += "@phone,";

insertSQL += "@fax,";

insertSQL += "@email,";

insertSQL += "@web_url,";

insertSQL += "@password,";

insertSQL += "@active,";

insertSQL += "@status,";

insertSQL += "NOW());";

insertSQL += " SELECT last_insert_id()";

MySqlConnection connection = null;

try

{

connection = new MySqlConnection([login to view URL]["DataBaseConnection"].ToString());

[login to view URL]();

MySqlCommand cmd = new MySqlCommand();

[login to view URL] = connection;

[login to view URL] = insertSQL;

[login to view URL]();

[login to view URL]("@fname", fname);

[login to view URL]("@lname", lname);

[login to view URL]("@company_name", company_name);

[login to view URL]("@address_1", address_1);

[login to view URL]("@address_2", address_2);

[login to view URL]("@city", city);

[login to view URL]("@state_id", state);

[login to view URL]("@postal_code", postal_code);

[login to view URL]("@phone", phone);

[login to view URL]("@fax", fax);

[login to view URL]("@email", company_email);

[login to view URL]("@web_url", website_url);

[login to view URL]("@password", company_name);

[login to view URL]("@active", 1);

[login to view URL]("@status", 1);

int id = [login to view URL]([login to view URL]());

[login to view URL](id);

}

finally

{

if (connection != null)

[login to view URL]();

}

.NET Програмування на C# MySQL SQL

ID Проекту: #9221700

Про проект

65 заявок(-ки) Дистанційний проект Остання активність Feb 12, 2016

65 фрілансерів(-и) готові виконати цю роботу у середньому за $20

hwanghendra

I can fix it in 10 minutes ............................................................................

$25 USD за 1 день
(402 відгуків(и))
7.1
rohitagarberg

Hi sir, Please send the cs file...I will fix right away. thanks.............................////////////////

$10 USD за 1 день
(166 відгуків(и))
6.1
sayka4salim

Can u please describe the error that you are having now? I can solve it asap

$20 USD за 1 день
(27 відгуків(и))
5.7
nikmah344

Hello, I have read through the job details extremely carefully and I am absolutely sure that I can do the project very well. I am having 6+ years of experience in Web Development. I have worked on below technologie Більше

$25 USD за 1 день
(37 відгуків(и))
5.9
murtaza1981

Hi, Please feel free to discuss the project with me ..................................................................................................... Thanks, Murtaza

$50 USD за 1 день
(11 відгуків(и))
4.5
RKYSP

Hi, I am an individual freelance, having more than 10yrs of exp in developing applications, window & web based, using .Net (C#.Net, Asp.Net (MVC), SignalR, XML,WPF, WCF (Webservices) kendo ui, Angular JS, MySQL and Більше

$10 USD за 0 дні(-в)
(19 відгуків(и))
4.3
parimal013

Hello sir, I am an experienced Software engineer based in INDIA.. I have 5 years of experience in software development, documentation and requirements elicitation. My experience revolves around web applicati Більше

$14 USD за 1 день
(4 відгуків(и))
4.0
umarch1

.net expert here. I can do your job. Further details on message please.

$20 USD за 1 день
(14 відгуків(и))
4.3
bookshop1989

Hello. Happy new year!!! I saw your description I have done several project like this. I'm an expert in Data Structures and Algorithms. And I know Java ,C/C++, C# , MySQL and Python well. I'm interested this pro Більше

$25 USD за 1 день
(10 відгуків(и))
3.9
florinbacu

A proposal has not yet been provided

$23 USD за 1 день
(8 відгуків(и))
3.6
alexgroa74

Hi! I can solve the issue, only I need identify the null fields to control them Regards!

$30 USD за 1 день
(2 відгуків(и))
3.0
shakilsama

I have around 2 years of working experience in MySQL. As an professionally experienced and young Software developer I really like to take on the task and will really appreciate if my first assignment can be from you. I Більше

$21 USD за 2 дні(-в)
(3 відгуків(и))
3.9
rcaisse

Hello. I am a senior level engineer and C# expert. In my full time job as a software engineer for a medical device company, I use C#/WPF with a MySQL database so I am very familiar with this development environment. I' Більше

$25 USD за 2 дні(-в)
(6 відгуків(и))
2.9
Jeevakavish

A proposal has not yet been provided

$10 USD за 0 дні(-в)
(8 відгуків(и))
3.0
DhvanitAkbari

Hello, I am a computer engineer and I have skills and experience in software development so if you give me a chance I can prove it to you. If you want we can chat further for details and so you can know more about me Більше

$10 USD за 0 дні(-в)
(10 відгуків(и))
2.7
nchandruk83

A proposal has not yet been provided

$20 USD за 1 день
(3 відгуків(и))
2.7
lazarmcvetkovic

Eight years of experience in developing applications on various platforms. Feel free to contact me.

$10 USD за 1 день
(5 відгуків(и))
2.6
habeeb83

A proposal has not yet been provided

$25 USD за 1 день
(1 відгук)
2.4
remonengineer

Hi, I have a very good experience in c# development and how to use it to connect to mysql database. Regards,

$20 USD за 1 день
(1 відгук)
2.8
CognitionCS

I see what's going on with your code. Won't take more than an hour to fix this issue from what I see on your code.

$30 USD за 1 день
(1 відгук)
0.9