theres no errors in my code - but it does nothing at all - its supposed to
be populating text boxes!!
any ideas ? (im am pretty new to all this)
If Not Page.IsPostBack Then
Dim search As String
Dim strConn As String =
"server=Gringot ts;uid=sa;pwd=p assword;databas e=database"
Dim sql As String = "Select * from table where ID = " + userid.Text.ToS tring
Dim conn As New System.Data.Sql Client.SqlConne ction(strConn)
Dim Cmd As New System.Data.Sql Client.SqlComma nd(sql, conn)
Dim objDR As System.Data.sql client.SqlDataR eader
conn.Open()
objDR = Cmd.ExecuteRead er(System.Data. CommandBehavior .CloseConnectio n)
While objDR.Read()
'userid.Text = objDR("userid")
surname1.Text = objDR("surname1 ")
firstname1.Text = objDR("fname1")
Title1 = objDR("title1")
End While
Page.DataBind()
End If 3 1569
Have you made sure that you are actually getting results back? The While
objDR.Read() loop will only occur while the datareader is reading, hence, if
there is nothing to read then the textboxes will not be loaded. Where is the
value for the userid.Text value coming from? Is it from a label? If it's
from a label that the user fills out, then presses a submit button to load
the data, then none of this will even happen because the IF statement is
making sure that the only time the code is executed is when the page first
loads. If this happens because of a user submitting then omit the Not in the
if statement because you want it to only occur when the page is posting
back. You also need to put something in there to make sure that there is a
valid userid in the textbox.
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"luna" <lu**@themoon.c om> wrote in message
news:Nh******** **********@news fep2-gui.server.ntli .net... theres no errors in my code - but it does nothing at all - its supposed to be populating text boxes!! any ideas ? (im am pretty new to all this)
If Not Page.IsPostBack Then
Dim search As String
Dim strConn As String = "server=Gringot ts;uid=sa;pwd=p assword;databas e=database"
Dim sql As String = "Select * from table where ID = " +
userid.Text.ToS tring Dim conn As New System.Data.Sql Client.SqlConne ction(strConn)
Dim Cmd As New System.Data.Sql Client.SqlComma nd(sql, conn)
Dim objDR As System.Data.sql client.SqlDataR eader
conn.Open()
objDR = Cmd.ExecuteRead er(System.Data. CommandBehavior .CloseConnectio n)
While objDR.Read()
'userid.Text = objDR("userid")
surname1.Text = objDR("surname1 ")
firstname1.Text = objDR("fname1")
Title1 = objDR("title1")
End While
Page.DataBind()
End If
You seem to misunderstand
i checked the SQL server and I know that there is data in there - definatley
im sure that the problem is something to do with
while objDR.Read()
surname1.text = objdr("surname1 ")
*************** ********* <---- here never gets touched when code is running
end while
I have hardcoded the SQL statement at the moment so that it looks like this:
Dim sql As String = "Select * from Personal where Personal.ID=2"
the thing that is annoying me is that the software seems to run perfectly
well, I dont get any error messages but it also doesnt
put anything into the textboxes or labels that i would like
any help that you could give me with this would be greatly appreciated
Mark.
"Mark Fitzpatrick" <ma******@fitzm e.com> wrote in message
news:OA******** ******@TK2MSFTN GP11.phx.gbl... Have you made sure that you are actually getting results back? The While objDR.Read() loop will only occur while the datareader is reading, hence,
if there is nothing to read then the textboxes will not be loaded. Where is
the value for the userid.Text value coming from? Is it from a label? If it's from a label that the user fills out, then presses a submit button to load the data, then none of this will even happen because the IF statement is making sure that the only time the code is executed is when the page first loads. If this happens because of a user submitting then omit the Not in
the if statement because you want it to only occur when the page is posting back. You also need to put something in there to make sure that there is a valid userid in the textbox.
Hope this helps, Mark Fitzpatrick Microsoft MVP - FrontPage
"luna" <lu**@themoon.c om> wrote in message news:Nh******** **********@news fep2-gui.server.ntli .net... theres no errors in my code - but it does nothing at all - its supposed
to be populating text boxes!! any ideas ? (im am pretty new to all this)
If Not Page.IsPostBack Then
Dim search As String
Dim strConn As String = "server=Gringot ts;uid=sa;pwd=p assword;databas e=database"
Dim sql As String = "Select * from table where ID = " + userid.Text.ToS tring Dim conn As New System.Data.Sql Client.SqlConne ction(strConn)
Dim Cmd As New System.Data.Sql Client.SqlComma nd(sql, conn)
Dim objDR As System.Data.sql client.SqlDataR eader
conn.Open()
objDR = Cmd.ExecuteRead er(System.Data. CommandBehavior .CloseConnectio n)
While objDR.Read()
'userid.Text = objDR("userid")
surname1.Text = objDR("surname1 ")
firstname1.Text = objDR("fname1")
Title1 = objDR("title1")
End While
Page.DataBind()
End If
I do understand. Having valid data in the database doesn't mean anything.
That's actually one of the worste ways to think when designing something
that queries the database as having data in the db is only a small part of
the battle. One of the things that happens often is the query that is sent
to the database is not exactly what you think it is. When this is the case,
it doesn't matter what data is in the database. Always try dumping your SQL
statement in testing before it is passed to the db to the browser or trace
through response.write( ) or trace.write(). This avoids a lot of unnecessary
tinkering sometimes as it's easy to keep working on the wrong things. In
this case, if you had dumped the sql string you would have noticed it wasn't
getting anything through the response.write when you clicked the button to
submit the userid because of the not page.ispostback condition
Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
"luna" <lu**@themoon.c om> wrote in message
news:db******** **********@news fep2-gui.server.ntli .net... You seem to misunderstand
i checked the SQL server and I know that there is data in there -
definatley im sure that the problem is something to do with
while objDR.Read()
surname1.text = objdr("surname1 ") *************** ********* <---- here never gets touched when code is
running end while
I have hardcoded the SQL statement at the moment so that it looks like
this: Dim sql As String = "Select * from Personal where Personal.ID=2"
the thing that is annoying me is that the software seems to run perfectly well, I dont get any error messages but it also doesnt put anything into the textboxes or labels that i would like
any help that you could give me with this would be greatly appreciated
Mark.
"Mark Fitzpatrick" <ma******@fitzm e.com> wrote in message news:OA******** ******@TK2MSFTN GP11.phx.gbl... Have you made sure that you are actually getting results back? The While objDR.Read() loop will only occur while the datareader is reading,
hence, if there is nothing to read then the textboxes will not be loaded. Where is the value for the userid.Text value coming from? Is it from a label? If it's from a label that the user fills out, then presses a submit button to
load the data, then none of this will even happen because the IF statement is making sure that the only time the code is executed is when the page
first loads. If this happens because of a user submitting then omit the Not in the if statement because you want it to only occur when the page is posting back. You also need to put something in there to make sure that there is
a valid userid in the textbox.
Hope this helps, Mark Fitzpatrick Microsoft MVP - FrontPage
"luna" <lu**@themoon.c om> wrote in message news:Nh******** **********@news fep2-gui.server.ntli .net... theres no errors in my code - but it does nothing at all - its
supposed to be populating text boxes!! any ideas ? (im am pretty new to all this)
If Not Page.IsPostBack Then
Dim search As String
Dim strConn As String = "server=Gringot ts;uid=sa;pwd=p assword;databas e=database"
Dim sql As String = "Select * from table where ID = " + userid.Text.ToS tring Dim conn As New System.Data.Sql Client.SqlConne ction(strConn)
Dim Cmd As New System.Data.Sql Client.SqlComma nd(sql, conn)
Dim objDR As System.Data.sql client.SqlDataR eader
conn.Open()
objDR = Cmd.ExecuteRead er(System.Data. CommandBehavior .CloseConnectio n)
While objDR.Read()
'userid.Text = objDR("userid")
surname1.Text = objDR("surname1 ")
firstname1.Text = objDR("fname1")
Title1 = objDR("title1")
End While
Page.DataBind()
End If
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ssb |
last post by:
Hello,
This may be very elementary, but, need help because I am new to access
programming.
(1) Say, I have a column EMPLOYEE_NAME. How do I fetch (maybe, cursor
?) the values one by one and populate a combo box with these names.
(this way, I can display all the EMPLOYEE_NAME values)
(2) In general, can I do additional processing on column values from
|
by: Andrew McKendrick |
last post by:
Hi,
I've noticed a bug in VB.NET (latest .NET Framework)...
- I have a TabControl on a form with several tabs.
- Each tab contains text boxes that are bound to fields in a data source
(DataBindings).
- When I display a record and then try to access the .Text property of one
of the text boxes on any tab except the current tab, the result is an Empty
string.
|
by: Bill Brinkworth |
last post by:
in vb.net 2005, i would like to pull up a name from a database (customers) (i
can do this already), then after a name is selected from a combox box, to
populate the form's text boxes with with data about that customer. I.E.: if
john is selected from the combo, i would like to have his address, city, etc.
filled out in the text boxes. I do not want to populate a listbox or
datagrid.....I do these easy as pie in Access but i just can not do...
|
by: jim |
last post by:
So I've had my knuckles rapped by a pro who can offer only vauge
advice. I need to reduce the size of one of my tables.
Here is the scene:
I'm trying to track lots of test scores for individual middle school
students.
I have a student info table using a student ID number as a primary key.
The columns in this table are:
|
by: emmaruwa |
last post by:
I have a form with two text boxes (in its details section) that pull data from two fields in my database table. This same form also has a button beside the text boxes which is supposed to open another form and populate that form with a record from the table using the data in the previous two text boxes as record selection criteria. However, it seems Access 2003 only uses one of the 2 text box data as criteria, i.e., no provision for using two...
| |
by: Dave |
last post by:
I have 3 tables of information feeding into 4 combo boxes on my main
form (DR Form). I have as many list boxes (acting as text boxes) as
there are fields in each one of the 3 tables. Once selecting from the
combo box, I have all the combo boxes, using afterupdate, populating
their respective list boxes. These text boxes are directly correlated
to the combo box selection using SQL. Here is an example from the
afterupdate event in the...
|
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ |
last post by:
I have created a report. This report needs to display records
between two dates entered by the user. I put two text boxes on the
report so I can enter the start and end date - I set them to use an
input mask of 'short date' format. The problem is that when I enter
anything in these text boxes, as soon as the field looses focus, the
text is cleared out - thus the text box is left blank. I have a button
on the form that calls the requery...
|
by: JonWB |
last post by:
Hi,
I am very new to .Net and have recently taken over someone else’s project. I am developing an asp webpage using C#.
I have an asp:table that is populated using data from a database. However, there is also a column that contains checkboxes and a column that contains text boxes like so:
Location | Stock | Issue (checkbox column) | Issued (textbox column)
I want the user to click a checkbox and the value of the ‘Stock’ column...
|
by: jgoodnight |
last post by:
Hi,
I have a form with three combo boxes: Area, Sub-Area, and Factor. I've set up the Sub-Area combo box to list only those areas that are part of the selected area. I've set up the Factor combo box to list only those factors that are part of the selected sub-area.
For example, if I select area 1.0, the Sub-Area combo box displays 1.1, 1.2, and 1.3 as options. It does not show 2.1, 3.1, etc.
If I select area 2.0, the Sub-Area combo box...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |