PC Review


Reply
Thread Tools Rate Thread

databind & find

 
 
Agnes
Guest
Posts: n/a
 
      11th Jul 2004
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.


 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      11th Jul 2004
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
////


 
Reply With Quote
 
Manuel Canas
Guest
Posts: n/a
 
      12th Jul 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      12th Jul 2004
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" <(E-Mail Removed)> 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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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.
> >
> >

>
>



 
Reply With Quote
 
Manuel Canas
Guest
Posts: n/a
 
      13th Jul 2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Databind ?? Adam J Knight Microsoft ASP .NET 2 1st Feb 2006 11:10 PM
Cant find the databind for data grid Roger Twomey Microsoft Dot NET Framework Forms 1 17th Nov 2005 06:45 AM
DataBind() =?Utf-8?B?UGFtIEFtbW9uZA==?= Microsoft C# .NET 3 13th Oct 2004 08:33 PM
DataBind Rafael Metring Microsoft Dot NET Compact Framework 1 27th Feb 2004 07:54 PM
DataBind Calvin Lai Microsoft ASP .NET 1 24th Jan 2004 10:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:04 PM.