语法错误 (操作符丢失) 在查询表达式 '[TutorialID]= and [TutorialType]='Video'' 中。
发表在ASP.NET图书答疑 2008-10-20
是否精华
版块置顶:
管理员你好:代码我上传了谢谢!!!!
分享到:
精彩评论 7
小宇O_O
学分:0 LV1
2008-10-20
沙发
读者
    您好,感谢您对明日图书的关注。 您说的问题应该是没有传入视频的ID造成的。不知道您是否是直接运行了seeVideo.aspx页面。如果是直接运行了该页面在该页面中并没有得到视频的ID,所以Request.QueryString["VideoID"]获取不到值。所以您要确保向seeVideo.aspx页面中传入视频的ID。
linjinbeiwei
学分:0 LV1
2008-10-20
板凳
[font color=#00FF00][FIELDSET][LEGEND]引自:1楼[/LEGEND]
读者
    您好,感谢您对明日图书的关注。 您说的问题应该是[font color=#FF0000]没有传入视频的ID[/font]造成的。不知道您是否是直接运行了seeVideo.aspx页面。如果是直接运行了该页面在该页面中并没有得到视频的ID,所以Request.QueryString["VideoID"]获取不到值。所以您要确保向seeVideo.aspx页面中传入视频的ID。
[/FIELDSET]

回复:
你好 !你说的没有传入视频的ID!!可是我是直接运行你们光盘配给的程序的啊.
麻烦给我看一下这段代码为什么会出错!
  [font color=#00FF00]前台代码[/font] <%=imageTitle%>
                    </span><span style="font-size: 15px">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 点击率:<%=ClickSum%></span>
                </td>
            </tr>
            <tr style="font-weight: bold; font-size: 14pt">
                <td align="center" colspan="4" style="height: 6%; width: 735px;" valign="top">
                <asp:Image ID="Image1" runat="server" ImageUrl="<%=SUrl%>" style="width: 420px; height: 340px"/> 
                   
    
&nbsp;<br />
                    &nbsp;
                </td>
            </tr>
        </table>
                    <table border="0" cellpadding="0" cellspacing="0" style="width: 559px; height: 140px">
                        <tr>
                            <td align="left" style="width: 34px" valign="top">
                                <asp:Label ID="Label1" runat="server" Text="内容简介:" Width="112px"></asp:Label></td>
                            <td align="left" colspan="2" rowspan="3">
                                <%=Content %>
                            </td>
                        </tr>
                        <tr>
                            <td align="left" style="width: 34px" valign="top">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 34px">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 34px; height: 22px">
                            </td>
                            <td align="right" style="width: 897px; height: 22px">
                                发布人:<%=Name %></td>
                            <td style="width: 350px; height: 22px">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 34px; height: 23px">
                            </td>
                            <td align="right" style="width: 897px; height: 23px">
                                发布日期:<%=FBDate%></td>

[font color=]后台代码:[/font] public string SUrl;
    public string imageTitle;
    public string Content;
    public string Name;
    public string FBDate;
    public string ClickSum;
    dataOperate mydo = new dataOperate();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            
            addClickSum();
           
        }
        seeImage();
    }
    //添加点击率
    public void addClickSum()
    {
        try
        {
            string sql = "update tb_Imges set ClickSum = ClickSum+1 where ImagesID =" + Request.QueryString["ImagesID"];

            mydo.updateData(sql);
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message.ToString());
        }
    }
    //浏览图片
    protected void seeImage()
    {
        try
        {
            string sql = "select * from tb_Imges where ImagesID =" + Convert.ToInt32(Request.QueryString["ImagesID"]);
            OleDbDataReader odr = mydo.row(sql);
            odr.Read();
            SUrl = "Images" + "\\" + odr["ImagesUrl"].ToString();
            if (!File.Exists(Server.MapPath(".") + "\\" + SUrl))
            {
                Page.RegisterStartupScript("true", "<script>alert('文件不存在!请返回!');location='Default.aspx'</script>");
            }
            imageTitle = odr["ImagesName"].ToString();
            Content = odr["ImagesContent"].ToString();
            Name = odr["Name"].ToString();
            FBDate = odr["FBDate"].ToString();
            ClickSum = odr["ClickSum"].ToString();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message.ToString());
"未将对象引用设置到对象的实例。不存在此行/列的数据。"      是没有取到值.
为什么会这样错在那里?能帮我改一下吗?[font color=#FF0000]急用!!!!!!
[/font]
小宇O_O
学分:0 LV1
2008-10-20
地板
您把程序上传,我帮你看一下
linjinbeiwei
学分:0 LV1
2008-10-21
4L
管理员你好:代码我上传了谢谢!!!!母版页没传..
小宇O_O
学分:0 LV1
2008-10-21
5L
您好,我运行了您上传的代码并没有出现你所说的错误。您可以使用断点一步一步调试一下。
linjinbeiwei
学分:0 LV1
2008-10-21
6L
管理员你好:根据你说的我进行了
设置断点:string sql = "select * from tb_Imges where ImagesID =" + Convert.ToInt32(Request.QueryString["ImagesID"]);
            OleDbDataReader odr = mydo.row(sql);
            odr.Read();
局部变量 sql null string
                     - odr null System.Data.OleDb.OleDbDataReader
应该是没有读到数据库.会不会是我的数据库有问题了.但是我的公告栏页面又能正常读取数据库库.还会有其他原因吗?

linjinbeiwei
学分:0 LV1
2008-10-21
7L
public partial class _viewImage : System.Web.UI.Page
{
    public string SUrl;
    public string imageTitle;
    public string Content;
    public string Name;
    public string FBDate;
    public string ClickSum;
此处设置断点:    dataOperate mydo = new dataOperate();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            
            addClickSum();
           
        }
        seeImage();
    }
    //添加点击率
    public void addClickSum()
    {
        try
        {
            string sql = "update tb_Imges set ClickSum = ClickSum+1 where ImagesID =" + Request.QueryString["ImagesID"];

            mydo.updateData(sql);
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message.ToString());
        }
    }
    //浏览图片
    protected void seeImage()
    {
        try
        {
            string sql = "select * from tb_Imges where ImagesID =" + Convert.ToInt32(Request.QueryString["ImagesID"]);
            OleDbDataReader odr = mydo.row(sql);
            odr.Read();
            SUrl = "Images" + "\\" + odr["ImagesUrl"].ToString();
            if (!File.Exists(Server.MapPath(".") + "\\" + SUrl))
            {
                Page.RegisterStartupScript("true", "<script>alert('文件不存在!请返回!');location='Default.aspx'</script>");
            }
            imageTitle = odr["ImagesName"].ToString();
            Content = odr["ImagesContent"].ToString();
            Name = odr["Name"].ToString();
            FBDate = odr["FBDate"].ToString();
            ClickSum = odr["ClickSum"].ToString();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message.ToString());
        }
    }

}

- this {ASP.viewimage_aspx} _viewImage {ASP.viewimage_aspx}
- [ASP.viewimage_aspx] {ASP.viewimage_aspx} ASP.viewimage_aspx
- base {ASP.viewimage_aspx} _viewImage {ASP.viewimage_aspx}
- base {ASP.viewimage_aspx} System.Web.UI.Page {ASP.viewimage_aspx}
- base {ASP.viewimage_aspx} System.Web.UI.TemplateControl {ASP.viewimage_aspx}
- base {ASP.viewimage_aspx} System.Web.UI.Control {ASP.viewimage_aspx}
Adapter null System.Web.UI.Adapters.ControlAdapter
AppRelativeTemplateSourceDirectory "" string
+ BindingContainer null System.Web.UI.Control
ChildControlsCreated false bool
ClientID null string
ClientIDSeparator 95 '_' char
+ Context {System.Web.HttpContext} System.Web.HttpContext
+ Controls {System.Web.UI.ControlCollection} System.Web.UI.ControlCollection
DesignMode false bool
EnableTheming true bool
EnableViewState true bool
+ Events {System.ComponentModel.EventHandlerList} System.ComponentModel.EventHandlerList
HasChildViewState false bool
ID null string
IdSeparator 36 '$' char
IsChildControlStateCleared false bool
IsTrackingViewState false bool
IsViewStateEnabled true bool
LoadViewStateByID false bool
+ NamingContainer null System.Web.UI.Control
+ Page null System.Web.UI.Page
+ Parent null System.Web.UI.Control
Site null System.ComponentModel.ISite
SkinID "" string
+ TemplateControl {ASP.viewimage_aspx} System.Web.UI.TemplateControl {ASP.viewimage_aspx}
TemplateSourceDirectory "" string
UniqueID null string
+ ViewState {System.Web.UI.StateBag} System.Web.UI.StateBag
ViewStateIgnoresCase false bool
Visible true bool
+ 静态成员
+ 非公共成员
AppRelativeVirtualPath null string
AutoHandlers 0 int
EnableTheming true bool
SupportAutoEvents true bool
+ 静态成员
+ 非公共成员
Application null System.Web.HttpApplicationState
AspCompatMode false bool
AsyncMode false bool
+ AsyncTimeout {00:00:45} System.TimeSpan
+ Buffer “((System.Web.UI.Page)(this)).Buffer”引发了“System.Web.HttpException”类型的异常 bool {System.Web.HttpException}
+ Cache “((System.Web.UI.Page)(this)).Cache”引发了“System.Web.HttpException”类型的异常 System.Web.Caching.Cache {System.Web.HttpException}
ClientQueryString "" string
+ ClientScript {System.Web.UI.ClientScriptManager} System.Web.UI.ClientScriptManager
ClientTarget "" string
+ CodePage “((System.Web.UI.Page)(this)).CodePage”引发了“System.Web.HttpException”类型的异常 int {System.Web.HttpException}
+ ContentType “((System.Web.UI.Page)(this)).ContentType”引发了“System.Web.HttpException”类型的异常 string {System.Web.HttpException}
+ Context {System.Web.HttpContext} System.Web.HttpContext
Culture "中文(中华人民共和国)" string
EnableEventValidation false bool
EnableViewState true bool
EnableViewStateMac false bool
ErrorPage null string
+ Form null System.Web.UI.HtmlControls.HtmlForm
Header null System.Web.UI.HtmlControls.HtmlHead
ID null string
IdSeparator 36 '$' char
IsAsync false bool
IsCallback false bool
IsCrossPagePostBack false bool
IsPostBack false bool
IsReusable false bool
+ IsValid “((System.Web.UI.Page)(this)).IsValid”引发了“System.Web.HttpException”类型的异常 bool {System.Web.HttpException}
+ Items {System.Collections.Specialized.HybridDictionary} System.Collections.IDictionary {System.Collections.Specialized.HybridDictionary}
LCID 2052 int
MaintainScrollPositionOnPostBack false bool
Master null System.Web.UI.MasterPage
MasterPageFile null string
MaxPageStateFieldLength 0 int
PageAdapter null System.Web.UI.Adapters.PageAdapter
+ PageStatePersister {System.Web.UI.HiddenFieldPageStatePersister} System.Web.UI.PageStatePersister {System.Web.UI.HiddenFieldPageStatePersister}
+ PreviousPage null System.Web.UI.Page
+ Request “((System.Web.UI.Page)(this)).Request”引发了“System.Web.HttpException”类型的异常 System.Web.HttpRequest {System.Web.HttpException}
+ Response “((System.Web.UI.Page)(this)).Response”引发了“System.Web.HttpException”类型的异常 System.Web.HttpResponse {System.Web.HttpException}
+ ResponseEncoding “((System.Web.UI.Page)(this)).ResponseEncoding”引发了“System.Web.HttpException”类型的异常 string {System.Web.HttpException}
+ Server {System.Web.HttpServerUtility} System.Web.HttpServerUtility
+ Session “((System.Web.UI.Page)(this)).Session”引发了“System.Web.HttpException”类型的异常 System.Web.SessionState.HttpSessionState {System.Web.HttpException}
SmartNavigation false bool
StyleSheetTheme null string
Theme null string
+ Title “((System.Web.UI.Page)(this)).Title”引发了“System.NullReferenceException”类型的异常 string {System.NullReferenceException}
+ Trace {System.Web.TraceContext} System.Web.TraceContext
TraceEnabled false bool
TraceModeValue SortByTime System.Web.TraceMode
TransactionMode 0 int
UICulture "中文(中华人民共和国)" string
UniqueFilePathSuffix "__ufps=842779" string
+ User {System.Security.Principal.WindowsPrincipal} System.Security.Principal.IPrincipal {System.Security.Principal.WindowsPrincipal}
+ Validators {System.Web.UI.ValidatorCollection} System.Web.UI.ValidatorCollection
ViewStateEncryptionMode Auto System.Web.UI.ViewStateEncryptionMode
ViewStateUserKey null string
Visible true bool
+ 静态成员
+ 非公共成员
+ ApplicationInstance {System.Web.HttpApplication} System.Web.HttpApplication
ClickSum null string
Content null string
FBDate null string
Image1 null System.Web.UI.WebControls.Image
imageTitle null string
Label1 null System.Web.UI.WebControls.Label
mydo null dataOperate
Name null string
Profile null System.Web.Profile.DefaultProfile
SUrl null string
+ 静态成员
+ base {ASP.viewimage_aspx} System.Web.UI.Page {ASP.viewimage_aspx}
+ ApplicationInstance {System.Web.HttpApplication} System.Web.HttpApplication
ClickSum null string
Content null string
FBDate null string
Image1 null System.Web.UI.WebControls.Image
imageTitle null string
Label1 null System.Web.UI.WebControls.Label
mydo null dataOperate
Name null string
Profile null System.Web.Profile.DefaultProfile
SUrl null string
首页上一页 1 下一页尾页 7 条记录 1/1页
手机同步功能介绍
友情提示:以下图书配套资源能够实现手机同步功能
明日微信公众号
明日之星 明日之星编程特训营
客服热线(每日9:00-17:00)
400 675 1066
mingrisoft@mingrisoft.com
吉林省明日科技有限公司Copyright ©2007-2022,mingrisoft.com, All Rights Reserved长春市北湖科技开发区盛北大街3333号长春北湖科技园项目一期A10号楼四、五层
吉ICP备10002740号-2吉公网安备22010202000132经营性网站备案信息 营业执照