本文介绍了您尝试执行不包含指定表达式“Student_Images”的查询作为聚合函数的一部分。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 这是我的代码 This is my codeDa = New OleDbDataAdapter("SELECT A.AdmissionID,A.FatherFN,A.FatherLN,A.FatMob,A.MotMob,A.SMSNo,A.SSession,A.AdmissionNo,A.BusFacility,R.SName,R.RollNo,R.ClassName,sum(S.Credit),sum(S.Debit),A.Student_Images " & "from ((Admission A " & "INNER JOIN StudentAccount S ON A.AdmissionID = S.AdmissionID) " & "INNER JOIN MasterRollNo R ON A.AdmissionID = R.AdmissionID) " & "where R.ExamName='" & ComboBox1.Text & "' and R.ClassName='" & ComboBox2.Text & "' " & "GROUP BY A.AdmissionID,A.FatherFN,A.FatherLN,A.FatMob,A.MotMob,A.SMSNo,A.SSession,A.AdmissionNo,A.BusFacility,R.SName,R.RollNo,R.ClassName", Conn) 推荐答案 Da = New OleDbDataAdapter("SELECT A.AdmissionID, A.FatherFN, A.FatherLN, A.FatMob, A.MotMob, A.SMSNo, A.SSession, A.AdmissionNo, A.BusFacility, R.SName, R.RollNo, R.ClassName, sum(S.Credit), sum(S.Debit), A.Student_Images " & "FROM ((Admission A " & "INNER JOIN StudentAccount S ON A.AdmissionID = S.AdmissionID) " & "INNER JOIN MasterRollNo R ON A.AdmissionID = R.AdmissionID) " & "WHERE R.ExamName = ? And R.ClassName = ? " & "GROUP BY A.AdmissionID, A.FatherFN, A.FatherLN, A.FatMob, A.MotMob, A.SMSNo, A.SSession, A.AdmissionNo, A.BusFacility, R.SName, R.RollNo, R.ClassName, A.Student_Images", Conn)' OleDb doesn't use named parameters, so only the order matters here:Da.SelectCommand.Parameters.AddWithValue("ExamName", ComboBox1.Text)Da.SelectCommand.Parameters.AddWithValue("ClassName", ComboBox2.Text) 你想知道关于SQL注入的一切(但不敢问) |特洛伊亨特 [ ^ ] 如何在没有技术术语的情况下解释SQL注入? |信息安全堆栈交换 [ ^ ] 查询参数化备忘单| OWASP [ ^ ] SQL注入攻击机制Pluralsight [ ^ ] Everything you wanted to know about SQL injection (but were afraid to ask) | Troy Hunt[^]How can I explain SQL injection without technical jargon? | Information Security Stack Exchange[^]Query Parameterization Cheat Sheet | OWASP[^]SQL injection attack mechanics | Pluralsight [^] 这篇关于您尝试执行不包含指定表达式“Student_Images”的查询作为聚合函数的一部分。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-01 11:57