Direct access to the fields in a table

I want to access the fields in a table directly.  How can this be done?
0
abnew
6/25/2006 7:12:00 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

7 Replies
497 Views

Similar Articles

[PageSpeed] 3

Is the table asp:Table or html table?  Post relevant code.
0
codeasp
6/25/2006 10:52:34 PM

The tables would be in ASP.

I was hoping for a simple example to get me going.  I have never done it before and the training sites have so much information before getting to the point.

If you can help me I would appreciate it.

0
abnew
6/26/2006 7:33:17 PM

Can you please explain about your scenario?  What kind of table and controls you want, is the values will be data driven, and when and what kind of information do you want to retrieve?  If you give that, then we will be able to provide you with the code or links where you can get the information.

0
codeasp
6/26/2006 9:13:53 PM
Okay, let us suppose the table has two fileds an 'id' and a
'description' filed.  'id' is the primary key.  The table
name is 'prsnlData'.  I also have a form called 'form1' that has a
text box on it called 'textbox1'. 

I would like to look up any record for example the record with id=5 and capture the description in that record to display in the textbox.


0
abnew
6/29/2006 11:57:31 AM

I am assuming that you are using DataTable (or DataSet) because you are persisting the data somewhere and have a primary key.  So in the database you have a table called prsnlData.  There are many ways you can achieve what you want.

1.  Get all the records (never a good idea, especially if you have lot of records, but for explanation purpose let it be) and store is in DataTable.  Get the user's input (in form of an ID) and then use the DataTable's Select method to get the record/s you want.

dim prsnlTable as DataTable = "Method to populate table"
' Get the specified user id

dim foundRows as DataRow() = prsnlTable.Select("ID = " & searchID )
' Check if rows are found
' If so display it
2.  This is the method you should probably use.  Get the user's input (ID) and then use sql/stored procedure to get only the record with that ID and then display the name.
0
codeasp
6/29/2006 9:17:06 PM
Could you give my an actual sample of the code?
0
abnew
7/1/2006 2:55:31 PM
 In the aspx page have following controls.
<asp:TextBox id="SearchIDBox" runat="Server" />
<asp:Button id="SearchBtn" runat="server" /> <br /> <br />
<asp:TextBox id="Description" runat="server" />
 In the code-behind 
Sub SearchBtn_Click(sender as Object, e as EventArgs)
   If SearchIDBox.Text <> "" Then
     ' You should probably check if search text can be converted to Integer
     ' But for simplicity sake I am assuming that user has entered a Number

     dim sID as Integer = CInt(SearchIDBox.Text)
     ' Create a Connection  and Command object
     ' If you are using SQL Server then SqlConnection
     ' Or else if you are using Access/MySQL then OleDBConnection

     ' Connect to db and get the result
     ' I am using Stored procedure and SqlDataReader

     dim reader as SqlDataReader = cmd.ExecuteReader
     ' Assuming ID is primary key and so only one record can exist

     if reader.read()
          description.text = reader("Description").ToString()
     else
          description.text = "No record found"
     end if
     ' Make sure to close the reader

     reader.close()
   End If
End Sub

Here is the sql

Create Procedure SearchByID
(
     @ID INT
)

SELECT Description
FROM TestData
WHERE ID = @ID
 
0
codeasp
7/2/2006 9:01:04 PM
Reply:

Similar Artilces:

accessing linked Access table from .net
We have an access database with a linked table to MYOB through ODBC. The MYOB table appears in access with a green dot indicating it's a linked table. In Access it all works fine. When we try to get at it through .net, it brings up DB_SEC_E_AUTH_FAILED(0x80040E4D) which as far as I can see indicates authentication failed. Any idea what is required to be able to use it from.Net? You might try this stepp0, put in admin for the username and leave the password blank (unless you specified other) Source=C:\Inetpub\wwwroot\Components\Databases\Db.m...

masterpage and control formatting (table control, HTML table control)
I have a master page that contains 1 contentplaceholder.  In my default.aspx (that uses the masterpage layout) I have a table server control.  During page_load I get the data I need and repeatedly add the usercontrol to the table control, one user control per row.  My user control is basically a HTML table with several rows and columns that's populated with data upon creation. I want this table to fill the contentplaceholder's width. In addition within the masterpage I have a CSS link for my stylesheet. Here are my questions: Is there a better way of adding ...

Can ADO.Net query/update a MS Access database that contains table and fields that contain blank spaces and characters such as "#" in their names?????
I've recently been assigned an asp.net/MS Access project. My code works fine; however, there are table and fields in the Access database that contain blank spaces and characters such as "#" in their names. For example there is a table named "Purchase Orders" and in this table there are a few column fields with names such as "PO#" and “Customer PO#". My question: Is there some sort of wrapping method that I need to implement to allow my ADO.net objects (particularly the "OleDbDataAdapter" and the "DataRow") to accept these naming...

Create access table using sql table field
 hi friends , i need create mdb file with table and data , the data will come from sql server 2005 table , for example i have table employee table contain some fields like name mobile number and others ,, now i  need to create access mdb file with table and data , data is mobile numbers of employee(just only one field) ,  i m using ASP.net C# 2.0, plz help me yarTHANKS FOR ADVANCE     Hello Raghavendra,                          &nbs...

ADO.NET table fields pass to a VB.NET variable
Hi, please help, have a ADO.NET code. 1 Dim conn As New Data.SqlClient.SqlConnection 2 Dim sql As New Data.SqlClient.SqlCommand 3 4 conn = New Data.SqlClient.SqlConnection("Provider=SQLOLEDB.1;Password=dbsystematics;Persist Security Info=True;User ID=sa;Initial Catalog=SARS;Data Source=4G") 5 conn.Open() 6 sql = New Data.SqlClient.SqlCommand("select * from users", conn)   Then i would like to pass the values that the above ADO.NET to a variable.how?please help. JFRBPH12™ You can execute the ...

How to add the data present in the controls to a table control without any database involvement.
Hi All,i am four controls where i will write the text and once i click the add button those should get added to the table .i want 6 columns fixed in the table and rows as many as required.i tried doing that taking a table server control and able to load the table.but the problem is whenver i am adding a new row the old one is gfetting overwritten by this and at the end i am getting only one row.  System.Web.UI.WebControls.Table t1 = new System.Web.UI.WebControls.Table();  i have declared the below one global TableRow tr; TableCell tc1; TableCell tc2; TableCell tc...

Multipage
how can I drag controls (eg table) directly onto a Multipage control. I'd rather not have to write all the HTML if I can possible avoid it.Caro You may drag the table control and put it inside a "<PAGEVIEW>" tag.This posting is provided "AS IS" with no warranties, and confers no rights. Caro, It's true that you cannot drag & drop ctrls directly in multipage. But you can, somewhere in the page, and paste your code after like this: <YourTagPrefix:PageView> <table> <tr> <td></td> <td></td> <td>...

accessing a field from a table?
id limit engine_size ncb tpo tpft comp 0 2000 1800 1 337 369 386 1 2000 1800 2 263 281 300 2 2000 1800 3 225 241 258 3 2000 1800 4 207 223 242 4 2000 1800 5 190 195 215 5 2000 2200 1 391 420 448 6 2000 2200 2 304 327 348 7 2000 2200 3 261 280 299 8 2000 2200 4 240 256 274 9 2000 2200 5 209 223 226 10 2000 3500 1 505 541 577 11 2000 3500 2 392 420 449 12 2000 3500 3 337 361 385 13 2000 3500 4 309 330 352 14 2000 3500 5 270 288 308 15 2000 35...

accessing a table fields
Dear all, I have a seperate table and i want to show the fields of another table in this new table. Is there any hint to do it. thanks ...

Access to fields in a table
I am trying to access the fields in a table using Visual Basic in Web Developer .NET Start with the link below and click on SelectCommand, InsertCommand, DeleteCommand and UpdateCommand to get tbe basic of manipulating data in the database through ADO.NET.  Hope this helps. http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqldataadapter.aspxKind regards,Gift Peddie...

Data presentation control in another Data presentation control
 Hello,I want to make a menu with datalist or gridview control.Basically,the menu will be like this,Categories     Sub Categories.For example, for COMPUTING category there will be NOTEBOOKS DESKTOPS etc.There will be a image for CATEGORIES and linkbuttons with Subcategories.If I put a datalist inside a datalist and a link button inside the second datalist visually it satisfies my need.However,CommandArguments come from database to linkbutton.Andwhen one of these command buttons is cliked it must go to proper page.I dont know how to wrie an event_handler ,specifically, for...

missing control access on table
IB2009, I am trying to set INACTIVE a trigger on a table where user has all rights with grant option and I get this error message. Where I can set control access on table ? This operation is not defined for system tables. unsuccessful metadata update. MODIFY TRIGGER failed. no permission for control access to TABLE FITIPPRTREG by user BALDINI. thanks Adalberto Baldini ...

.Net and Access with Hyperlinked Fields
Can somebody help me ? I have an Access DB in this DB I have a few fields that are hyperlink in the DB When I set up a ASP.net page the links are not hyperlinked. this is what my script looks like <%@ Page Explicit="True" Language="VB" Debug="True" %> <%@ Import Namespace="System.Data" %> <%@ Import Namespace="System.Data.OleDb" %> <html> <script runat="server"> Sub Search_Click(Sender As Object, E As EventArgs) Dim Connect As OleDbConnection = New OleDbConnection D...

Controls in tables not accessible in Codebehind
Hi People, I have an asp:button in an asp:tablecell, why cant the code behind calss access it through the this pointer (C#). if i creat a button outside the table the codebehind calss knows about it fine. Also in the designer view (VS 2003) I cannot double-click on a control inside a table to automate the event handler code? Can anyone help please? Rgrds, SFB When you put Controls inside a TableCell, you have to manually create those objects in your code behind. You are correct in that you cannot click on a Button in the designer and have its event automagically wired up ...

Web resources about - Direct access to the fields in a table - asp.net.presentation-controls

Direct-broadcast satellite - Wikipedia, the free encyclopedia
Direct broadcast satellite (DBS) is a term used to refer to satellite television broadcasts intended for home reception. A designation broader ...

U2, Foo Fighters, Motorhead cancel Paris shows in 'first direct hit on music'
Foo Fighters, U2 and Motorhead have cancelled their French concerts while Parisian cinemas remain in lock down.

QOTD: direct from Bizarroworld
QOTD: direct from Bizarroworld by digby I stole this from TNR , but it's irresistible. It's from Kevin Williamson at National Review: Conservatives ...

Facebook just launched a chat app for companies that's a direct threat to Slack
... many companies currently get from Slack. According to the TechCrunch report, the Work Chat app will allow employees of a company to send direct ...

"Direct hit on music": Stars reeling from Paris attacks
U2 among many bands canceling shows while others pay tribute on stage in wake of deadly attacks

1366 Technologies Direct Wafer Product Hits Performance Record
... solar silicon wafering process, namely, the wasted silicon saw dust (kerf) that is part of the conventional [&hellip 1366 Technologies Direct ...

All the news from Nintendo Direct for November 2015
A recap of everything announced during today's livestream presentation.

Bono on Paris attacks: 'This is the first direct hit on music'
U2 were rehearsing at the AccorHotels Arena in Paris Friday night, less than three miles away from the Bataclan concert hall where the Eagles ...

‘Drumline’ Charles Stone Set To Direct Broad Green Sorority Comedy ‘Ain’t No Half Steppin’
Drumline helmer Charles Stone has boarded Broad Green ’s Ain't No Half Steppin , an upbeat comedy from screenwriter Chuck Hayward ( Cooper Barrett's ...

Everything from the November Nintendo Direct
That Nintendo Direct won E3. With a far better showing than its June event ( sans the amazing puppets ), Nintendo knocked it out of the park. ...

Resources last updated: 11/24/2015 2:16:28 AM