C# MySQL insert data issue

Cerrado Publicado Jan 4, 2016 Pagado a la entrega
Cerrado Pagado a la entrega

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 Programación en C# MySQL SQL

Nº del proyecto: #9232020

Sobre el proyecto

45 propuestas Proyecto remoto Activo Feb 12, 2016

45 freelancers están ofertando un promedio de $23 por este trabajo

rinsadsl

Hello Good Day We can help you on this project. We have worked a lot with .net and mysql. Looking forward to hear from you. Thanks Rinsad

$24 USD en 0 días
(711 comentarios)
9.0
abugosia

A proposal has not yet been provided

$30 USD en 1 día
(186 comentarios)
6.9
gkalish

I worked lot of projects n mysql and willing to fix the issue within 30 minutes .

$30 USD en 1 día
(226 comentarios)
6.7
zuiguanglong

Hi, Yes. C# is my SKILL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! I have already find your issue Let's build success!!! Thank you for your time and consideration.

$24 USD en 1 día
(40 comentarios)
6.0
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 Más

$25 USD en 1 día
(37 comentarios)
5.9
sunny945

Hi ! i am a professional c# and database developer and mysql Expert. i want to work on your project. i can debug and complete this in no time

$10 USD en 1 día
(54 comentarios)
5.3
bilal78699

Hi, I'm expert in C#, MySQL and many other technologies, just send me your code or lets have a teamviewer session. I need to figure out where is the issue. It will be done right away during the session. Thanks, Más

$10 USD en 0 días
(11 comentarios)
5.1
ahmednayl12345

Hello sir i can login in now with team viewer and solve it plz message me to start now thanks ahmed nayl

$15 USD en 1 día
(16 comentarios)
4.8
HealthyCoder

Hello Sir, Being a Software Engineer i can do your job easily, i have 3 years experience with C# desktop application development, come to chat for detail conversation about your project. Regards Sibghat Ullah

$15 USD en 1 día
(14 comentarios)
4.5
ashupathania

I have 4 + years of experience in MSBI Technology(SQL Server 2008/2012) Worked with the reputed clients like Microsoft and Dick Sporting goods. Worked with the Huge datasets , Query optimization,Execution plans ,SSI Más

$30 USD en 1 día
(23 comentarios)
4.8
softtechsurat

Hello sir/madam, we have read and understand your requirement and very much confident that we can complete this project within low budget and less time . Give us chance to serve you better... Thanks & Regards, Más

$24 USD en 1 día
(18 comentarios)
4.2
zealoustech15

A proposal has not yet been provided

$10 USD en 1 día
(10 comentarios)
3.4
singharun171287

A proposal has not yet been provided

$20 USD en 2 días
(8 comentarios)
3.2
ratheeshkumar1

.Net Developer With 6 years of development experience in Microsoft technologies! My core expertise is in developing and designing web applications and distributed software. I have worked extensively on MVC, , and Más

$20 USD en 1 día
(2 comentarios)
2.7
habeeb83

A proposal has not yet been provided

$25 USD en 1 día
(1 comentario)
2.4
matash23

Good afternoon, I'm looking forward to contact me and start a collaboration with long-term effect, hopefully with great results.I have a strong experience in C# /ASP. NET / MySQL as I have been working in these areas f Más

$10 USD en 1 día
(2 comentarios)
2.0
KERConsultancy

-- why you are doing it with inline query and not store procedure? -- even if you want to do with inline query, i don't think so it's neat. -- there could be many reasons for this error, so better to discuss in chat Más

$15 USD en 1 día
(4 comentarios)
1.9
remonengineer

Hi. I have a good experience in c# and my sql database. Regards,

$10 USD en 1 día
(1 comentario)
2.8
MabroukHarabi

A proposal has not yet been provided

$25 USD en 0 días
(1 comentario)
1.0
visualorborlandc

Hy there I have seen your code you people are using wrong syntax. For further discussion please add me on skype:- sheheryar_25 Regard's Sheheryar

$25 USD en 1 día
(0 comentarios)
0.0