473,385 Members | 1,409 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

asp to mysql help needed

Hi Forum,

I am having some really iritating problems with an simple input page which should pass parameters into a stored procedure from the text boxes first and last name.

I keep getting the error during exection of sp_myinsert, pfirstname not defined, every time i try to submit the form

Has anyone got any suggestions I have giving my code for procedure and page

many thanks
boy
--------------------------------

CREATE DEFINER=``@`localhost` PROCEDURE `sp_myInsert`(pFirstName varchar(20), pLastName varchar(30))
BEGIN
INSERT INTO Names (FirstName, LastName) values (pFirstName, pLastName);

END
-------------------------------------------

<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace = "System.Data" %>
<%@ Import Namespace = "MySql.Data.MySqlClient" %>
<script language="VB" runat="server">

Sub page_load()

End Sub

''' <summary>
''' Page_load
''' Recognised by ASP and must be provided on loading of page.
'''
''' Creates connection to database, passes stored procedure into test database
''' and fills a table, which is showing in web browser
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>


Sub sendData(ByVal sender As Object, ByVal e As EventArgs)
Dim litErr As New LiteralControl


'Create connection string to pass database, string holds login information to mySQL,
Dim connectionString As String
connectionString = "Server=; uid=; pwd=;database=test;"

'Builds .net mysql connection and passes connection string into method
Dim connection As New MySqlConnection(connectionString)
'Open connection to DB
connection.Open()

'Create mySql command string for passing query or SPROC(Stored Procedure)
Dim cmdString As New MySqlCommand
'Set Command to equal mySql connection,t so can pass SQL query
cmdString.Connection = connection

Try
'Set command string to equal SPROC
cmdString.CommandText = "sp_myinsert"
'ONLY PLACE THIS IF SPROC, sets the command to a SPROC
cmdString.CommandType = CommandType.StoredProcedure

Dim param As New MySqlParameter


param = cmdString.Parameters.Add("pfirstname", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = txtFirstName.Text

param = cmdString.Parameters.Add("plastname", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = txtLastName.Text


cmdString.ExecuteNonQuery()
connection.Close()
Catch ex As Exception
litErr.Text = ex.Message
MsgBox(ex.Message)

End Try



End Sub



</script>

<!DOCTYPE html PUBLIC
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script language="vbscript" type="text/vbscript">

</script>
</head>
<body>
<form id="form1" runat="server">

ENTER FIRSTNAME<asp:TextBox runat="server" ID="txtFirstName">
</asp:TextBox><br /><br />
ENTER LAST NAME
<asp:TextBox runat="server" ID="txtLastName"></asp:TextBox>
<asp:Button runat="server" ID="submit" Text="Submit" onclick="sendData" />



</form>
</body>
</html>
Jun 27 '07 #1
0 1154

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: user mysql | last post by:
HELLO FRIENDS. HERE A FANTASTIC NEWS FOR MYSQL WINDOWS USER. READE THIS. The article is grab from www/internetnews/com/ DO YOU THINK THAT IS A GOOD NEWS ? ...
11
by: George Augustino | last post by:
REQUEST FOR DISCUSSION (RFD) unmoderated group comp.databases.mysql Newsgroup line: comp.databases.mysql MySQL relational database system discussion group. This is a formal Request For...
2
by: s a n j a y | last post by:
Hi All, I am want to upgrade MySQL from 4.0 to 4.1 on linux. The reason being the subqueries. Problem is Failed dependencies: libcrypto.so.0.9.6 is needed by MySQL-Max-4.1.0-0...
4
by: blizeach | last post by:
The problem is that when I installed Slackware I told it to install MySQL. I thought it did so. I looked around and found in the directory /etc/rc.d/ a file called rc.mysqld.new wich I read. It...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
3
by: Saqib Ali | last post by:
I have set up MySQL on my machine and can successfully use it. However, I'm trying to set up TOra so that I can browse the databases effectively. I'm having lots of trouble trying to get TOra to...
3
by: Nick | last post by:
hi, all I have a red hat 9 and looks like it had mysql 3.2.54 installed before, but, actually not, i can not find the install folder and I can not uninstall it. So I am trying to install/upgrade...
3
by: Richard Petty | last post by:
Today I began preparations for upgrading MySQL. I downloaded the binary RPMs for Red Hat Enterprise 4 (we're running CentOS, a clone) for MySQL 5.0.13 from the MySQL AB web site. Running a test, I...
1
by: Good Man | last post by:
Hi there I've noticed some very weird things happening with my current MySQL setup on my XP Laptop, a development machine. For a while, I have been trying to get the MySQL cache to work....
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.