473,399 Members | 4,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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 1266
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 FillDatasetAndBindings()
ds.Clear()
Dim sqlString As String = "Select * from countries"
da = New OleDb.OleDbDataAdapter(sqlString, conn)
da.Fill(ds)
Dim dt As DataTable = ds.Tables(0)
dv = New DataView(dt)
dv.Sort = "Id"
cma = DirectCast(BindingContext(dv), CurrencyManager)
Dim cmb As New OleDb.OleDbCommandBuilder(da)
TextBox1.DataBindings.Clear()
TextBox2.DataBindings.Clear()
TextBox1.DataBindings.Add("text", dv, "Id")
TextBox2.DataBindings.Add("text", dv, "Name")
ListBox1.DataSource = dv
ListBox1.DisplayMember = "Name"
If ds.Tables(0).Rows.Count = 0 Then
cma.AddNew()
TextBox1.Focus()
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
'Adding of a new row
cma.AddNew()
TextBox1.Focus()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
'Delete
dv(cma.Position).Delete()
End Sub
Private Sub Button3_Click_1(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button3.Click
'Add it to the dataset and to the
cma.EndCurrentEdit()
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button4.Click
'Write it to the database
cma.EndCurrentEdit()
If ds.HasChanges Then
Try
da.Update(ds)
Catch ex As OleDb.OleDbException
MessageBox.Show(ex.Message, "OleDbException")
Exit Sub
Catch ex As Exception
MessageBox.Show(ex.Message, "GeneralException")
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, ConnectionString)

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(BindingContext(dv), CurrencyManager)

Dim cmb As New SqlCommandBuilder(da)

and then the binding part follows.

Thanks bud for your great help.
Manuel
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:O7**************@tk2msftngp13.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*****@hotmail.com> schreef in bericht
news:K2mIc.21433$2i3.11511@clgrps12...
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, ConnectionString)

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(BindingContext(dv), CurrencyManager)

Dim cmb As New SqlCommandBuilder(da)

and then the binding part follows.

Thanks bud for your great help.
Manuel
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:O7**************@tk2msftngp13.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***@dynamictech.com.hk> wrote in message
news:O7**************@tk2msftngp13.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
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...
1
by: Andreas Klemt | last post by:
Hello, for what is Page.DataBind useful and what is it doing? Thanks for any answer! Andreas
3
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...
2
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...
8
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);"...
4
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...
7
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...
0
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
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...
0
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,...
0
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...

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.