473,699 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

databind & find

Sorry for my question again.
My form got the previous , next , top,bottom button and allow the user to
move the records . Now, the table got 500 records, I need to do a features
for the user to input the 300th records(e.g invoiceno is 00301) and search
it, and then move to 301,302, or move back to 299,298.

I don't know how to do , Thanks in advance.
Nov 20 '05 #1
4 1294
Hi Agnes,

A sample I made yesterday, I think that it fits all your problem, instead of
buttons I use a listbox which shows it even nicer. It is a sample, there is
no valuating or things like that in it.

I hope this helps?

Cor
\\\
Private Sub FillDatasetAndB indings()
ds.Clear()
Dim sqlString As String = "Select * from countries"
da = New OleDb.OleDbData Adapter(sqlStri ng, conn)
da.Fill(ds)
Dim dt As DataTable = ds.Tables(0)
dv = New DataView(dt)
dv.Sort = "Id"
cma = DirectCast(Bind ingContext(dv), CurrencyManager )
Dim cmb As New OleDb.OleDbComm andBuilder(da)
TextBox1.DataBi ndings.Clear()
TextBox2.DataBi ndings.Clear()
TextBox1.DataBi ndings.Add("tex t", dv, "Id")
TextBox2.DataBi ndings.Add("tex t", dv, "Name")
ListBox1.DataSo urce = dv
ListBox1.Displa yMember = "Name"
If ds.Tables(0).Ro ws.Count = 0 Then
cma.AddNew()
TextBox1.Focus( )
End If
End Sub
Private Sub Button1_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button1.Click
'Adding of a new row
cma.AddNew()
TextBox1.Focus( )
End Sub
Private Sub Button2_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button2.Click
'Delete
dv(cma.Position ).Delete()
End Sub
Private Sub Button3_Click_1 (ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button3.Click
'Add it to the dataset and to the
cma.EndCurrentE dit()
End Sub
Private Sub Button4_Click(B yVal sender As System.Object, _
ByVal e As System.EventArg s) Handles Button4.Click
'Write it to the database
cma.EndCurrentE dit()
If ds.HasChanges Then
Try
da.Update(ds)
Catch ex As OleDb.OleDbExce ption
MessageBox.Show (ex.Message, "OleDbException ")
Exit Sub
Catch ex As Exception
MessageBox.Show (ex.Message, "GeneralExcepti on")
Exit Sub
End Try
End If
End Sub
////
Nov 20 '05 #2
Hey, great coding man.

Need some more help from you guy, if you don't mind.

Now I'm trying to add a second table to my dataset, this is the code I've
come up with.
Dim SqlString As String = "SELECT * FROM tb_Test2"

da = New SqlDataAdapter( SqlString, ConnectionStrin g)

da.Fill(ds)

Dim dt As DataTable = ds.Tables(1) Is this the Right way to add another
table to the dataset??? it says that it cannot find the table 1

dv = New DataView(dt)

dv.Sort = "ID"

cmaBilling = DirectCast(Bind ingContext(dv), CurrencyManager )

Dim cmb As New SqlCommandBuild er(da)

and then the binding part follows.

Thanks bud for your great help.
Manuel
"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:O7******** ******@tk2msftn gp13.phx.gbl...
Sorry for my question again.
My form got the previous , next , top,bottom button and allow the user to
move the records . Now, the table got 500 records, I need to do a features
for the user to input the 300th records(e.g invoiceno is 00301) and search it, and then move to 301,302, or move back to 299,298.

I don't know how to do , Thanks in advance.

Nov 20 '05 #3
Hi Manuel,

You are almost imposible to help, you drop everywhere your messages.
I said to you that it is better to stay in the original thread, than there
can be looked back what was your problem. And to add questions to messages
like everybody else do so it is showed that it is a question.

Now for everybody else this looks as an asnwer to the qeustion from Agnes/

Your answer

da.fill(ds, "dt1") ' is what I think is the most easy one.

And you can make a choise to make two dataadapters or to do everytime a new
commandbuilder before the update).

I think that make one time two dataadapters will be the most efficient when
you are updating. (Without updating you can go for one).

I hope this helps?

Cor
"Manuel Canas" <mc*****@hotmai l.com> schreef in bericht
news:K2mIc.2143 3$2i3.11511@clg rps12...
Hey, great coding man.

Need some more help from you guy, if you don't mind.

Now I'm trying to add a second table to my dataset, this is the code I've
come up with.
Dim SqlString As String = "SELECT * FROM tb_Test2"

da = New SqlDataAdapter( SqlString, ConnectionStrin g)

da.Fill(ds)

Dim dt As DataTable = ds.Tables(1) Is this the Right way to add another
table to the dataset??? it says that it cannot find the table 1

dv = New DataView(dt)

dv.Sort = "ID"

cmaBilling = DirectCast(Bind ingContext(dv), CurrencyManager )

Dim cmb As New SqlCommandBuild er(da)

and then the binding part follows.

Thanks bud for your great help.
Manuel
"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:O7******** ******@tk2msftn gp13.phx.gbl...
Sorry for my question again.
My form got the previous , next , top,bottom button and allow the user to move the records . Now, the table got 500 records, I need to do a features for the user to input the 300th records(e.g invoiceno is 00301) and

search
it, and then move to 301,302, or move back to 299,298.

I don't know how to do , Thanks in advance.


Nov 20 '05 #4
Hey Cor, sorry about the multiposting again. I did that just in case you
missed this one.
Hey bud, I know you said that I could add a second dataadapter for the other
table. now how can I tied together so when I click an item on the list box,
both tabs would display the same ID data from the different table?

Thanks so much for your great day man.

Manuel

"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:O7******** ******@tk2msftn gp13.phx.gbl...
Sorry for my question again.
My form got the previous , next , top,bottom button and allow the user to
move the records . Now, the table got 500 records, I need to do a features
for the user to input the 300th records(e.g invoiceno is 00301) and search it, and then move to 301,302, or move back to 299,298.

I don't know how to do , Thanks in advance.

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1055
by: Jeff Reed | last post by:
I have a data grid and when the user clicks Edit link in row one of the data columns should change to a drop down list. Instead I keep getting an error..."Specified cast is not valid.". I'm not doing any CASTing myself, but I think its getting done automatically. The data in the datasource contains System.Decimal fields. I'm not sure whether that is being automatically CASTed to a string or not.
1
4048
by: Andreas Klemt | last post by:
Hello, for what is Page.DataBind useful and what is it doing? Thanks for any answer! Andreas
3
12016
by: Marty McDonald | last post by:
I have <asp:Table... </asp:Table> on my webform. In codebehind, I populate a DataTable whose data should appear in the asp:Table. I created my own code to populate the asp:Table with the DataTable, then I discovered the asp:Table has a DataBind method. But the method takes no args and so I'm confused how to use it. Is there a link to see how DataBind works for asp:Table? Should I just use my own code anyway? Thanks... Here's my...
2
4777
by: Jim Heavey | last post by:
Hello, when I place the command of "Page.Databind()" into my program, the program generates and error saying "value was outside of range". If I take the instruction out, then the page displays and does not abend. Of course the fields that I want to display data do not have data on them I have 5 instructions which are of the <%# %> variety. If I take all of them out, and leave in the page bind, the same error occurs. I have seached the...
8
2807
by: Nathan Sokalski | last post by:
I add a JavaScript event handler to some of my Webcontrols using the Attributes.Add() method as follows: Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);" TextBox2.Attributes.Add("onKeyPress", jscode) You will notice that jscode contains the JavaScript Logical And operator (&&). However, ASP.NET renders this as &amp;&amp; in the code that is
4
1822
by: Arpan | last post by:
The following code works fine: <script runat="server"> Dim strName As String = "Arpan" Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs) Page.DataBind() End Sub </script> <form runat="server">
7
2607
by: ThunderMusic | last post by:
Hi, This question probably went back a couple of times, but I didn't find anything about it on google, so I ask here... What is the best way to use the DataSource/DataBind pattern in a class? I would like the user to be able to set a data source and I'd like my class to be able to use this datasource to build a DataTable I could use for further processing... Can it be done? if it can, how?
0
1379
by: ack95 | last post by:
Simply question How can I DataBind() a DataViewManager to a GridView in ASP.NET? Question in Detail We have a DataSet with relational DataTables (total of 5). We are generating emails with user specific data, so instead of going back to the DB for every user, we are getting all data once and filtering on the DataSet per user (most data overlaps users so this seems like a good strategy). Our main GridView has child GridView controls...
1
1842
by: Dunc | last post by:
Has anyone come across a way to bind simple properties (e.g. <%# DateTime.Now.Year %>, <%# UserName %in the underlying HTML) without doing a general DataBind(); call? Not only does it seem a massive waste of resources, I find this call extremely annoying, particularly when working with Master pages where inevitably I'll end up wiping out any manually build controls such as added options to dropdowns.
0
8687
marktang
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...
1
8914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8884
tracyyun
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...
0
7751
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6534
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5875
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();...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3057
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.