本文介绍了您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以便在...附近使用正确的语法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我谢谢.Pls请

错误: - 你的SQL语法错误;查看与您的MySQL服务器版本对应的手册,以便在''密钥,软件,防病毒,扫描仪,打印机,ups,otheritem,createdby,createdon)值附近使用正确的语法(''在第1行



Pls help me Thanks in Advance..Pls pls
Error:- You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''key,software,antivirus,scanner,printer,ups,otheritem,createdby,createdon)values('' at line 1

pcperforma pc = new pcperforma(0, Session["refguid"].ToString(), Convert.ToInt32(ddldept.SelectedValue), txtname.Text, txtmobileno.Text, ddlpc.SelectedValue, txtcpu.Text, txtmotherboard.Text, txtram.Text, txtharddisk.Text, txtdvdwriter.Text, txtcabinet.Text, txtsmps.Text, txtkeyboard.Text, txtmouse.Text, txtgraphiccard.Text, txtmacid.Text, txtlancardip.Text, txtlcdmoniter.Text, ddlwindows.SelectedValue, txtwindowkey.Text, txtsoftware.Text, txtantivirus.Text, txtscanner.Text, txtprinter.Text, txtups.Text, txtotheritems.Text, crtby);
                   pc.CreatePcPerforma(con, tran);





和通话功能是: -





And The Calling Function is:-

public bool CreatePcPerforma(MySqlConnection con, MySqlTransaction tran)
    {
        int r = 0;
        try
        {
            string qry = "insert into pcdetails(refid,deptnameid,username,mobileno,pc,cpu,motherboard,ram,harddisk,dvdwriter,cabinet,smps,keyboard,mouse,graphiccard,macid,ip,monitor,window,key,software,antivirus,scanner,printer,ups,otheritem,createdby,createdon)values(@refid,@deptnameid,@username,@mobileno,@pc,@cpu,@motherboard,@ram,@harddisk,@dvdwriter,@cabinet,@smps,@keyboard,@mouse,@graphiccard,@macid,@ip,@monitor,@window,@key,@software,@antivirus,@scanner,@printer,@ups,@otheritem,@createdby,now())";
            MySqlParameter refidP = new MySqlParameter("@refid", RefId);
            MySqlParameter deptnameidP = new MySqlParameter("@deptnameid", DeptNameId);
            MySqlParameter usernameP = new MySqlParameter("@username", UserName);
            MySqlParameter mobilenoP = new MySqlParameter("@mobileno", MobNo);
            MySqlParameter pcP = new MySqlParameter("@pc", PC);
            MySqlParameter cpuP = new MySqlParameter("@cpu", CPU);
            MySqlParameter motherboardP = new MySqlParameter("@motherboard", MotherBoard);
            MySqlParameter ramP = new MySqlParameter("@ram", RAM);
            MySqlParameter harddiskP = new MySqlParameter("@harddisk", HardDisk);
            MySqlParameter dvdwriterP = new MySqlParameter("@dvdwriter", DvdWriter);
            MySqlParameter cabinetP = new MySqlParameter("@cabinet", Cabinet);
            MySqlParameter smpsP = new MySqlParameter("@smps", SMPS);
            MySqlParameter keyboardP = new MySqlParameter("@keyboard", Keyboard);
            MySqlParameter mouseP = new MySqlParameter("@mouse", Mouse);
            MySqlParameter graphiccardP = new MySqlParameter("@graphiccard", GraphicCard);
            MySqlParameter macidP = new MySqlParameter("@macid", MacIp);
            MySqlParameter ipP = new MySqlParameter("@ip", IP);
            MySqlParameter monitorP = new MySqlParameter("@monitor", Monitor);
            MySqlParameter windowP = new MySqlParameter("@window", Window);
            MySqlParameter keyP = new MySqlParameter("@key", Key);
            MySqlParameter softwareP = new MySqlParameter("@software", Software);
            MySqlParameter antivirusP = new MySqlParameter("@antivirus", Antivirus);
            MySqlParameter scannerP = new MySqlParameter("@scanner", Scanner);
            MySqlParameter printerP = new MySqlParameter("@printer", Printer);
            MySqlParameter upsP = new MySqlParameter("@ups", UPS);
            MySqlParameter otheritemP = new MySqlParameter("@otheritem", OtherItem);
            MySqlParameter createdbyP = new MySqlParameter("@createdby", CreatedBy);
            MySqlParameter[] p = { refidP, deptnameidP,usernameP,mobilenoP,pcP,cpuP,motherboardP,ramP,harddiskP,dvdwriterP,cabinetP,smpsP,keyboardP,mouseP,graphiccardP,
                                 macidP,ipP,monitorP,windowP,keyP,softwareP,antivirusP,scannerP,printerP,upsP,otheritemP,createdbyP};
            r = common.ExecuteNonQuery(con, tran, qry, p);
            if (r > 0)
            {
                return true;
            }
            else
            {
                Exception xp = new Exception("Create Personal Computer Description  Error.");
                throw xp;
            }
        }
        catch
        {
            Exception ex = new Exception("Create Personal Computer Description Error.");
            throw ex;
        }
    }

推荐答案


这篇关于您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以便在...附近使用正确的语法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 08:04