-
May 2nd, 2008, 11:00 PM
#1
Thread Starter
Hyperactive Member
[2008] save to an access database
Hello,
I have a database with street addresses in it. I built a program that submits the addresses to whitepages.com. Then I added some code to get the phone number from whitepages.com and put it in a text box. Now I need to save that to the access database. In my data base there are 7 columns. One for address,city,state,zip,name,phone #,auto number. I need to save the phone number in the phone # column in the same row as the address that was used to retrieve it from whitepages.com. So if the phone # is (222)333-4444 then I don't want that to be stored in a new row (so far that is the only way I have found to do it).
I would appreciate your help very much
-
May 2nd, 2008, 11:16 PM
#2
Frenzied Member
Re: [2008] save to an access database
There is possibly a better way of doing this but here goes.
I load the listview's selected row (which is filled from a access data base) onto a second form that has 6 textbox's and delete the selected listview's row.
Code:
Try
Edit.txtComponentName.Text = Me.ListView1.SelectedItems(0).Text
Edit.txtMaterial.Text = Me.ListView1.SelectedItems(0).SubItems(1).Text
Edit.txtLengthSize.Text = Me.ListView1.SelectedItems(0).SubItems(2).Text
Edit.txtQuantity.Text = Me.ListView1.SelectedItems(0).SubItems(3).Text
Edit.txtlmNo.Text = Me.ListView1.SelectedItems(0).SubItems(4).Text
Edit.txtNotes.Text = Me.ListView1.SelectedItems(0).SubItems(5).Text
Edit.Show()
Catch ex As Exception
MsgBox("Select a Component to Edit First")
Exit Sub
End Try
'delete selected listview row
For i As Integer = Me.ListView1.SelectedItems.Count - 1 To 0 Step -1
Me.ListView1.Items.Remove(Me.ListView1.SelectedItems(i))
Next i
I edit the textbox (this is where you could load the phone number into one) then save back to the listview
Code:
With frmMaterialList.ListView1.Items.Add(Me.txtComponentName.Text)
.SubItems.Add(Me.txtMaterial.Text)
.SubItems.Add(Me.txtLengthSize.Text)
.SubItems.Add(Me.txtQuantity.Text)
.SubItems.Add(Me.txtlmNo.Text)
.SubItems.Add(Me.txtNotes.Text)
End With
Me.Close()
HTH
ps, any chance of seeing the code you used to get the phone number
-
May 2nd, 2008, 11:34 PM
#3
Thread Starter
Hyperactive Member
Re: [2008] save to an access database
I will try the code and upload the "phone numeber getter" code. cause it is getting really late here.
-
May 3rd, 2008, 02:29 AM
#4
Re: [2008] save to an access database
Follow the Data Access link in my signature to see some ADO.NET code examples. The one to interest you is the one that retrieves, edits and saves data. You are already getting the address from a row in the database so you already know EXACTLY which row to update. Once you get the phone number you simply assign the value to the appropriate column of the very same row you got the address from in the first place. Once you've got all the phone numbers you need you save the changes back to the database.
-
May 3rd, 2008, 03:05 PM
#5
Thread Starter
Hyperactive Member
Re: [2008] save to an access database
Is it possible to use
Code:
DataSet1.table.column.Caption = TextBox1.Text
Is there a way to make that work?
-
May 3rd, 2008, 08:01 PM
#6
Re: [2008] save to an access database
vb.net Code:
myDataSet.Tables(tableIndex).Columns(columnIndex).ColumnName = columnName
-
May 3rd, 2008, 08:58 PM
#7
Thread Starter
Hyperactive Member
Re: [2008] save to an access database
thanks but i think i will just save it to a text file as index,phone# then improt it into access later.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|