Petri.com forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri IT Knowledgebase Forums > Microsoft BackOffice > SQL Server 2005 / 2008 / 2008 R2 / 2012
Petri.com is happy to award RicklesP the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri IT Knowledgebase Forums Search Todays Posts Today's Posts Mark Forums Read
Notices

How do I populate mysql field with textbox string

How do I populate mysql field with textbox string

this thread has 3 replies and has been viewed 6008 times

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 9th August 2011, 00:02
5habbaranks 5habbaranks is offline
Member
Staying around
 
 Join Date: Nov 2010
  6 month star 12 month star
 Location: UK - OK.
 Posts: 298
 Reputation: 5habbaranks is on a distinguished road (24)
Default How do I populate mysql field with textbox string

Howdy all....

I still have my stablisers on as far as vb.net and mysql are concerned. What I am trying to do is populate a status field within mysql with the content from a textbox in vb.net. I have my link working as I have populated a combo box from the same table but I cant work out how to do it the other way.

Answers on a postcard or preferably in a box below.

Thanks loads
  #2  
Old 9th August 2011, 00:26
5habbaranks 5habbaranks is offline
Member
Staying around
 
 Join Date: Nov 2010
  6 month star 12 month star
 Location: UK - OK.
 Posts: 298
 Reputation: 5habbaranks is on a distinguished road (24)
Default Re: How do I populate mysql field with textbox string

Just to elaborate on this a little. I have a combo box which populates from a mysql table. I then populate a textbox with "some text" from a button. Then what I am trying to do is populate the relative field "status" for the selected name from the combo box within the mysql db.

Confused? Sorry
  #3  
Old 9th August 2011, 00:57
gforceindustries's Avatar
gforceindustries gforceindustries is offline
Senior Member
Wrote the book
 
 Join Date: Sep 2008
  6 month star 12 month star
 Location: Leics, UK
 Posts: 4,352
 Reputation: gforceindustries is a jewel in the roughgforceindustries is a jewel in the roughgforceindustries is a jewel in the roughgforceindustries is a jewel in the rough (310)
Default Re: How do I populate mysql field with textbox string

So you get data from the database to populate the combo box, but want to save the text entered on the form to the database?

Where you use a SELECT to fetch data, use INSERT or UPDATE as appropriate to write back.
__________________
Gareth Howells

BSc (Hons), MBCS, MCP, MCDST, ICCE

Any advice is given in good faith and without warranty.

Please give reputation points if somebody has helped you.

"For by now I could have stretched out my hand and struck you and your people with a plague that would have wiped you off the Earth." (Exodus 9:15) - I could kill you with my thumb.

"Everything that lives and moves will be food for you." (Genesis 9:3) - For every animal you don't eat, I'm going to eat three.
  #4  
Old 9th August 2011, 12:13
5habbaranks 5habbaranks is offline
Member
Staying around
 
 Join Date: Nov 2010
  6 month star 12 month star
 Location: UK - OK.
 Posts: 298
 Reputation: 5habbaranks is on a distinguished road (24)
Default Re: How do I populate mysql field with textbox string

Thanks I do get that, the problem occurs when I am trying to change the code to achieve the INSERT. Here is my get code:

Dim sStmt As String = "SELECT CONCAT (firstname, "" "", surname) AS FullName FROM phonebook"

Dim da As New MySqlDataAdapter(sStmt, con)
Dim dt As New DataTable("table")
da.Fill(dt)

If dt.Rows.Count > 0 Then
ComboBox1.DisplayMember = "FullName"
ComboBox1.DataSource = dt
End If

Am I correct in thinking the Dim da As New MySqlDataAdapter(sStmt, con) handles the actual data? After that I am stuck as to how to tell the code to write to the specific field based on the result of the combo box?

Appreciate your patience - Im not the quickest when it comes to vb.net & mysql
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
pre populate Fields address tab mhoogev SBS 2000 / 2003 / 2008 / 2011 0 23rd December 2009 14:58
How do I query and import data in a textbox into a datagridview VB VS 08 JenniferBarman General Scripting 0 7th September 2009 02:54
CheckBox enables Textbox aflamal Outlook 2 22nd November 2007 13:38
Auto populate server name when clicking check name m80arm Exchange 2000 / 2003 0 1st September 2006 12:07
Outlook 2000 auto-populate shizrah Outlook 1 23rd February 2006 10:20


All times are GMT +3. The time now is 09:25.

Steel Blue 3.5.4 vBulletin Style ©2006 vBEnhanced
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
 

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri