Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 12th, 2006, 06:44 PM
Registered User
 
Join Date: Jan 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default calling an UPDATE command from a textbox

Hi,

I know that the book says that somehow I can update an Access database from a textbox but I cannot seem to figure how to do it. Point me in the right direction, please!

Also, is there some way that I can call a control on an .aspx page from an .aspx.vb page? Can not seem to figure this out either. Some small code example would be very helpful for either problem.

Thanks,

Tom
 
Old January 16th, 2006, 02:21 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nalla Send a message via Yahoo to nalla
Default



Hi,

I hope this example will help you. This is how you update your database(serverdatabase) using data entered in to a text box calles Text1.


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

   Dim strConnection As String = "Data Source=(LOCAL);" _
                               & "Initial Catalog=serverdatabase;" _
                               & "user id=sa;password=sa"

   Dim myConnection As New SqlConnection(strConnection)

   myConnection.Open()

   Dim cmdupdate As New SqlCommand("UPDATE table1 SET flield1='" & TextBox1.Text & "'", myConnection)

   cmdupdate.ExecuteNonQuery()

End Sub


If you need more information, please post
nalla



 
Old January 16th, 2006, 02:25 PM
Registered User
 
Join Date: Jan 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply.

I am using an Access database and I think I must use a paramatized list to update. I don't know how to bind this. When I run the code no update occurs.

Tom

 
Old January 19th, 2006, 12:31 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nalla Send a message via Yahoo to nalla
Default


Hi TomTab,

Check these.
(1) Did you pass the sql to the CommandText property with parameter acceptors?
(2) Did you pass the parameter properly to the parameter array?

Please post the code if you need more help?


nalaka hewage





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update command yogeshyl Oracle 0 November 28th, 2007 08:05 AM
Shell command or calling VB exe netfresher General .NET 3 October 30th, 2006 06:23 AM
Calling a command from a servlet emirant1 Servlets 1 December 23rd, 2005 11:33 AM
Update Command In DataGrid RPG SEARCH ASP.NET 1.0 and 1.1 Basics 9 February 21st, 2005 09:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.