文本框错误 [英] textbox error

查看:76
本文介绍了文本框错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好:
我在使用文本框时遇到问题,请使用以下代码:

hello:
im having trouble with textbox,i use this code:

<asp:TextBox ID="alma" Text="0000" MaxLength="5"   runat="server" />         



并在vb.net中



and in vb.net

Dim mCon As OdbcConnection
mCon = New OdbcConnection()
Dim sConnString As String = "Dsn=PostgreSQL30;Database=xxx;Server=localhost;Port=5432;Uid=xxx;Pwd=xxx"
mCon = New OdbcConnection(sConnString)

dim sql as string ="insert into table(almacen) values (' " & alma.text & " ')"
dim cm as new odbcCommand(sql,mCon)


它有效,但Visual Studio说:未声明名称" alma"

请帮助


it works but visual studio say : "name ''alma'' is not declared"

help please

推荐答案

您确定此代码位于与aspx页面关联的代码文件中吗? IE. aspx页面顶部的CodeBehind属性是否指向您要从中访问文本框的文件?
Are you sure that this code is in the code file associated with the aspx page? ie. Does the CodeBehind attribute at the top of the aspx page point to the file you''re trying to access the text box from?


您是说这个意思:
do you mean this:
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="BUSCAR.aspx.vb"  Inherits="BUSCAR" %>


此问题的一个潜在来源是使两个不同的.aspx文件指向同一个.aspx.vb文件.

另一个可能的来源是,如果您在同一目录中具有相同.aspx和.aspx.vb文件的副本.例如,您将文件复制到Windows资源管理器(.aspx的副本)中以将您的工作保存为某个点.将这些副本删除或移出Web应用程序文件夹.


您还可以尝试本文中的一些步骤:

http://forums.asp.net/p/976740/1240521 [
One potential source of this problem is having two different .aspx files pointing to the same .aspx.vb file.

Another potential source is if you have copies in the same directory of the same .aspx and .aspx.vb files. For example you copied the files in windows explorer(copy of ... .aspx) to save your work as some point. Delete or move those copies out of the webapplication folders.


You could also try some of the steps in this post:

http://forums.asp.net/p/976740/1240521[^]


这篇关于文本框错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆