本文介绍了C#中的SQL查询语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 我正在尝试在桌面上运行查询,但一直收到错误: 参数化查询'(@TourName char (8000))更新ToursTbl SET可用性=(可'期望参数'@TourName',未提供。 我猜它与我如何提供@TourName参数有关.Heres my code任何帮助?? for(int i = 0; i< bookedToursArray.Length; i ++) { //命令更新巡视表中可用巡视的数量 SqlCommand cmd2 = new SqlCommand( ); cmd2.CommandText =UPDATE ToursTbl SET Availability =(Availability-1)WHERE TourName ='@ CityName'; cmd2.Parameters.Add(@ TourName,SqlDbType.Char)。 Value = bookedToursArray [i]; cmd2.Connection = conn; conn.Open(); cmd2.ExecuteNonQuery (); conn.Close(); } 我尝试过: 问题似乎是我的语法解决方案 I'm trying to run a query on a table but keep getting the error:The parameterized query '(@TourName char(8000))UPDATE ToursTbl SET Availability = (Availa' expects the parameter '@TourName', which was not supplied.I guessing its to do with how I've provided the @TourName parameter. Heres my code Any help??for (int i = 0; i < bookedToursArray.Length; i++) { //command to update the number of available tours in the tours table SqlCommand cmd2 = new SqlCommand(); cmd2.CommandText = "UPDATE ToursTbl SET Availability = (Availability-1) WHERE TourName = '@TourName'"; cmd2.Parameters.Add("@TourName", SqlDbType.Char).Value = bookedToursArray[i]; cmd2.Connection = conn; conn.Open(); cmd2.ExecuteNonQuery(); conn.Close(); }What I have tried:The problem seems to be my syntax 解决方案 这篇关于C#中的SQL查询语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的.. 09-08 09:36