C# MySQL insert data issue

ปิด โพสต์แล้ว Jan 4, 2016 ชำระเงินเมื่อจัดส่ง
ปิด ชำระเงินเมื่อจัดส่ง

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

หมายเลขโปรเจค: #9232020

เกี่ยวกับโปรเจกต์

44 ข้อเสนอ โปรเจกต์ระยะไกล ใช้งาน %project.latestActivity_relativeTime|แทนที่%

freelancer 44 คน กำลังเสนอราคาในงานนี้ โดยมีราคาเฉลี่ยอยู่ที่ $23

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 ใน 0 วัน
(815 รีวิว)
9.4
abugosia

A proposal has not yet been provided

$30 USD ใน 1 วัน
(250 รีวิว)
7.0
gkalish

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

$30 USD ใน 1 วัน
(226 รีวิว)
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 ใน 1 วัน
(40 รีวิว)
5.9
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.8
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 ใน 1 วัน
(54 รีวิว)
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, เพิ่มเติม

$10 USD ใน 0 วัน
(11 รีวิว)
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 ใน 1 วัน
(16 รีวิว)
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 ใน 1 วัน
(14 รีวิว)
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 เพิ่มเติม

$30 USD ใน 1 วัน
(23 รีวิว)
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, เพิ่มเติม

$24 USD ใน 1 วัน
(18 รีวิว)
4.2
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 เพิ่มเติม

$15 USD ใน 1 วัน
(6 รีวิว)
3.6
zealoustech15

A proposal has not yet been provided

$10 USD ใน 1 วัน
(10 รีวิว)
3.3
singharun171287

A proposal has not yet been provided

$20 USD ใน 2 วัน
(8 รีวิว)
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 เพิ่มเติม

$20 USD ใน 1 วัน
(2 รีวิว)
2.7
habeeb83

A proposal has not yet been provided

$25 USD ใน 1 วัน
(1 รีวิว)
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 เพิ่มเติม

$10 USD ใน 1 วัน
(2 รีวิว)
2.0
remonengineer

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

$10 USD ใน 1 วัน
(1 รีวิว)
2.8
MabroukHarabi

A proposal has not yet been provided

$25 USD ใน 0 วัน
(1 รีวิว)
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 ใน 1 วัน
(0 รีวิว)
0.0