The problem is that when I compile the following code, it doesn't show me any output. The database is connected and the text box (read-only) is also displayed. But the desired output is not obtained.
Code:
<%@ Import namespace="system.data.oledb"%>
<%@ Import namespace="system.data"%>
<%@ Page Language="vb"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>dbtextbox</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:TextBox id="dumb" style="Z-INDEX: 100; LEFT: 144px; POSITION: absolute; TOP: 96px" runat="server"
Width="128px" ReadOnly="True"></asp:TextBox>
</form>
<script runat="server" language="vb">
sub rate_capture(o as object, e as eventargs)
dim dtrate as oledbdatareader
dim con1 as new oledbconnection("Provider=MSDAORA.1;User ID=SCOTT;Password=TIGER;Data Source=HARI")
con1.open()
dim cmd1 as new oledbcommand("select rate from test1 where car_code='CAMXL04'",con1)
dtrate=cmd1.executereader()
dtrate.close()
con1.close()
dumb.Text = String.Empty
If dtrate.Read() Then
Dim currentValue As Object = dtrate("rate")
If not currentValue is System.DBNull.Value Then
dumb.Text = currentValue.ToString().Trim()
End If
End If
end sub
</script>
</body>
</HTML>
What I wanted to know is, is this code right in the first place? I'm not pretty much sure about the code. The second thing is that, the contents of this text box is supposed to change according to a drop down list (which I have not included in the above code). Therefore in the query I have given all the conditions that it needs to satisfy to retrieve the data that I want. The following is the table
Table Test1
Name Type
car_code varchar2(8)--> This is the code that I've specified in the query
descript varchar2(50)
rate varchar2(4)--> This is what I want to display in the read only text box according to the above car_code
The car_code is as I've shown in the query "CAMXL04" and the corresponding rate can be, say, 65. The descript could be anything. The only thing that matters to me right now is to display the rate according to the car_code.
Thanks in advance,
Regards,
Praveen