-
Jul 12th, 2016, 12:49 PM
#1
Thread Starter
Junior Member
[RESOLVED] add data programmatically to sql table vs 2015
I'm really sorry to ask this newbie question, but I just need a kick start...
hypothetically speaking:
Let say I have Table1 with Rows.... Name , Address
I just want to click a button and have "Tom", "123 Blank St." added to the Row programmatically.
Thanks in advance!
-
Jul 12th, 2016, 12:57 PM
#2
Re: add data programmatically to sql table vs 2015
That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma
Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney
-
Jul 12th, 2016, 01:01 PM
#3
Re: add data programmatically to sql table vs 2015
The problem is there are many ways to accomplish this. It really depends on what method your using to connect/retrieve the data, how are you displaying the data. Google "visual basic add data to database", you'll see lots of answers.
-
Jul 12th, 2016, 01:15 PM
#4
Re: add data programmatically to sql table vs 2015
No need to apologize for asking a question...
There are literally a gazillion ways to accomplish this, it all depends as rightfully mentioned by wes4dbt, how you will be approaching this. Do you have any coding so far?
VB.NET MVP 2008 - Present
-
Jul 12th, 2016, 01:36 PM
#5
Thread Starter
Junior Member
Re: add data programmatically to sql table vs 2015
Thanks Hannes. I watched a few videos and found how to add a database and create the table in vs 2015, and so I tried this code to no avail:
Code:
TlbLogViewBindingSource.AddNew()
Dim rNewRow As DataRow
Dim nDate As System.DateTime = System.DateTime.Now
nDate = Now
rNewRow = TlbLogViewBindingSource.AddNew
rNewRow.Item("DATE") = nDate
rNewRow.Item("NAME") = "Joe"
TlbLogViewBindingSource.Add(rNewRow)
TlbLogViewBindingSource.EndEdit()
TableAdapterManager.UpdateAll(DsHHLogView)
MessageBox.Show("It worked!")
-
Jul 12th, 2016, 01:46 PM
#6
Re: add data programmatically to sql table vs 2015
OK, do you get any errors?
Here are a few articles I wrote which I hope might be helpful to ou:
Exploring the Data Controls in Visual Basic.NET
http://www.codeguru.com/columns/vb/e...-basic.net.htm
Doing Data Extraction with Visual Basic.NET
http://www.codeguru.com/columns/vb/d...-basic.net.htm
Using Parameterized Queries and Reports in VB.NET Database Applications
http://www.codeguru.com/columns/vb/u...plications.htm
Using SQL Stored Procedures with VB.NET
http://www.codeguru.com/columns/vb/u...ith-vb.net.htm
Doing SQL Transactions with Visual Basic
http://www.codeguru.com/columns/vb/d...ual-basic.html
VB.NET MVP 2008 - Present
-
Jul 12th, 2016, 02:01 PM
#7
Thread Starter
Junior Member
Re: add data programmatically to sql table vs 2015
Thanks so much! I got it to work for what I was trying to accomplish.
I just needed to use:
Code:
Table1TableAdapter.Insert(nDate, "Joe")
Table1TableAdapter.Fill(DatabaseName)
Thanks to all of you guys for the help!!
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
|