...

View Full Version : retrieve data from input box to table



cgibie
04-05-2007, 07:55 PM
Say I have this code, but I want to retrieve from whatever the user inputs in the input box. php has $_POST feature, but I am not aware of asp.net.I want to get that input box (whatever the user entered) and store into my tblTest table.



Imports System.Data.SqlClient

Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim ra As Integer
Dim cnn As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("LocalSQLServer").ConnectionString)
Dim cmd As New SqlCommand("insert into tblTest (NameID, Name) VALUES ('3', 'Test3')", cnn)
'Dim qry As New SqlDataReader

cnn.Open()
ra = cmd.ExecuteNonQuery()
Response.Write("Inserted!")

cnn.Close()
End Sub
End Class

cgibie
04-06-2007, 05:12 PM
Hello?

nikkiH
04-06-2007, 07:17 PM
Please re-read the basic tutorial on how asp.net works, postbacks, etc.
http://quickstarts.asp.net/QuickStartv20/aspnet/Default.aspx

That said, due to postback, you don't need anything at all to get it. It's there. Whatever you called your textbox, the Text property. It's stored in the view state and just referenced like
myTextboxName.Text



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum