[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Using a button to initiate a sql data source insert

Posted on 2007-10-08
4
Medium Priority
?
214 Views
Last Modified: 2013-11-26
I have created a sql data source that inserts a row into a table and I want a button to initiate or run it.  Can someone give me the code to do this.   Do I have to generate code with a Button Click or can I set it up with a property?
0
Comment
Question by:keithwilson1
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:MikeGT
ID: 20037510
If all you want to do is activate the datasource from the button click, simply add it to the click event of the button, then make the calls to your datasource. I am not sure what type of code you are looking for as you have given no information about the datasource you have

It could be something as simple as

private void button2_Click(object sender, EventArgs e)
{
      YourDataSource ds = new YourDataSource();
      ds.DoInsert(data);
}
0
 

Author Comment

by:keithwilson1
ID: 20037633
Could you give me the VB version?
0
 

Author Comment

by:keithwilson1
ID: 20037656
In VB, I am getting ,"DoInsert is not a member of System.Web.UI.WebControls.SqlDataSource."  
0
 
LVL 5

Accepted Solution

by:
MikeGT earned 2000 total points
ID: 20037815
DoInsert was only an example. I do not know anything baout your datasource class to know exactly what calls you need to execute.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question