Click here to Skip to main content
15,889,808 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hello:
im having trouble with textbox,i use this code:
<asp:TextBox ID="alma" Text="0000" MaxLength="5"   runat="server" />         


and in vb.net
VB
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)

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

help please
Posted
Updated 29-Sep-10 12:50pm
v2
Comments
Henry Minute 29-Sep-10 18:53pm    
if you enclose your code snippets in <pre></pre> tags it improves their readability

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?
 
Share this answer
 
do you mean this:
<%@ Page Language="VB" AutoEventWireup="true" CodeFile="BUSCAR.aspx.vb"  Inherits="BUSCAR" %>
 
Share this answer
 
v2
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[^]
 
Share this answer
 
Forgive me, I don't work with ASP.Net often (which is the forum where this question SHOULD have gone!), but should that be ID="alma", or Name="alma"?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900