Hi Folks,
I'm completely new to this stuff so bear with me. And if this isn't the correct forum, just let me know which this should be in and I'll post it there. VB and VWD are both .NET apps so I figure this is the right place.
I'm using VWD and want to have a form, the contents of which get inserted into a sql db. I was able to find the following code that I tweaked a bit to get working in a VB program but cannot figure out how to adjust it to work on a web page. I'm still finding and watching videos and reading books I've downloaded and I'm learning a lot...but the answer to this seems to be evading me. I can use VWD's Gridview, etc. tools to populate a table but I would like to be able to make a custom form with a button to do the job instead.
So here's the VB code I found and was able to teach myself how to use....and actually got it working in a program.... -
Private Sub btnEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnter.Click
-
-
Dim SQLtext As String
-
Dim myCon As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=E:\Documents and Settings\Bob\My Documents\Visual Studio 2005\Projects\Addresses\Addresses\FirstDatabase.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
-
-
SQLtext = "INSERT INTO Addresses (FirstName, LastName, StreetAddress, City, Phone) VALUES(@txtFirstName, @txtLastName, @txtStreetAddress, @txtCity, @txtPhone)"
-
-
Dim myCom As New SqlClient.SqlCommand(SQLtext, myCon)
-
-
Dim val1 = Me.txtFirstName.Text
-
Dim val2 = Me.txtLastName.Text
-
Dim val3 = Me.txtStreetAddress.Text
-
Dim val4 = Me.txtCity.Text
-
Dim val5 = Me.txtPhone.Text()
-
-
-
myCom.Parameters.Add(New SqlClient.SqlParameter("@txtFirstName", SqlDbType.VarChar)).Value = val1
-
myCom.Parameters.Add(New SqlClient.SqlParameter("@txtLastName", SqlDbType.VarChar)).Value = val2
-
myCom.Parameters.Add(New SqlClient.SqlParameter("@txtStreetAddress", SqlDbType.VarChar)).Value = val3
-
myCom.Parameters.Add(New SqlClient.SqlParameter("@txtCity", SqlDbType.VarChar)).Value = val4
-
myCom.Parameters.Add(New SqlClient.SqlParameter("@txtPhone", SqlDbType.VarChar)).Value = val5
-
-
End Sub
-
-
Thanks much,
Bob
0 774 Sign in to post your reply or Sign up for a free account.
Similar topics
by: piperzen |
last post by:
Hi,
I'm developing a set of language learning exercises for
http://www.yale.edu/swahili , and we've run into a javascript question
that the programmer doesn't know how to tackle (we mostly work...
|
by: dskillingstad |
last post by:
I'm trying to assign a custom value to a textbox. Here's what I have.
I've created a module and "default value" code for a textbox which
generates a custom auto-number (yyyy-0000) when a New...
|
by: Miguel Dias Moura |
last post by:
Hello,
I am working in ASP.net / VB with Access Database.
i have a Multipage in my web site with the Submit button as the last button.
When the Submit button is pressed i want the form...
|
by: Oz |
last post by:
Hi
Using VS.NET 2003, Windows XP SP1,
We have a page which has been developed using ASP.NET. On it, is a button
which when clicked is supposed to add some data to a table. When the button
is...
|
by: Klaus Jensen |
last post by:
Hi!
This has been annoying me all day, and I can't get it to work It is really
driving me nuts!
Basicly this simple webapp created to illustrate my problem, renders five
buttons, and adds a...
|
by: John Boy |
last post by:
Hi,
Can anyone help. This is really doing my nut in. 3 years ASP exp. and
now doing .DOT which is a step in the wrong direction.
Basically I am left with the code of a guy who has left. When I...
|
by: Stephen D Cook |
last post by:
What I am trying to do is have a set of option buttons which are
required to click one. If the person doesn't click any before insert,
they get an error. If they do click one, it inserts into the...
|
by: Neo Geshel |
last post by:
Greetings.
I am in a very big pickle. I am trying to add page content - as well as
a submit button - programatically to a web form that is supposed to
submit to DB and then refresh.
That...
|
by: cindy |
last post by:
I have a form, has javascript registered so a modal pops up.
Button click will close form.
Now I need to do an update with modal form data before it closes.
I can put a second button and register...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |