Click here to Skip to main content
15,881,938 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to maintain text in textbox while navigatin to different page. Pin
André Stroebel27-Jun-07 1:19
André Stroebel27-Jun-07 1:19 
AnswerRe: How to maintain text in textbox while navigatin to different page. Pin
Amit Kumar G27-Jun-07 0:40
Amit Kumar G27-Jun-07 0:40 
GeneralRe: How to maintain text in textbox while navigatin to different page. Pin
rahul.net1127-Jun-07 1:12
rahul.net1127-Jun-07 1:12 
GeneralRe: How to maintain text in textbox while navigatin to different page. Pin
Amit Kumar G27-Jun-07 1:31
Amit Kumar G27-Jun-07 1:31 
QuestionValidation Code Pin
ballameharmurali27-Jun-07 0:23
ballameharmurali27-Jun-07 0:23 
AnswerRe: Validation Code Pin
Amit Kumar G27-Jun-07 0:33
Amit Kumar G27-Jun-07 0:33 
GeneralRe: Validation Code Pin
ballameharmurali27-Jun-07 19:51
ballameharmurali27-Jun-07 19:51 
Questioninput form help! Pin
boyindie27-Jun-07 0:17
boyindie27-Jun-07 0:17 
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("p_firstname", MySqlDbType.VarChar)
param.Direction = ParameterDirection.Input
param.Value = txtFirstName.Text

param = cmdString.Parameters.Add("p_lastname", 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>
QuestionExport Access Reports Pin
André Stroebel27-Jun-07 0:11
André Stroebel27-Jun-07 0:11 
AnswerRe: Export Access Reports Pin
Pallavi Bhoite27-Jun-07 1:03
Pallavi Bhoite27-Jun-07 1:03 
GeneralRe: Export Access Reports Pin
André Stroebel27-Jun-07 1:24
André Stroebel27-Jun-07 1:24 
GeneralRe: Export Access Reports [modified] Pin
Pallavi Bhoite27-Jun-07 1:44
Pallavi Bhoite27-Jun-07 1:44 
GeneralRe: Export Access Reports Pin
André Stroebel27-Jun-07 1:57
André Stroebel27-Jun-07 1:57 
GeneralRe: Export Access Reports Pin
Pallavi Bhoite27-Jun-07 2:12
Pallavi Bhoite27-Jun-07 2:12 
GeneralRe: Export Access Reports Pin
André Stroebel27-Jun-07 2:37
André Stroebel27-Jun-07 2:37 
QuestionMid function.......... Pin
n_gchaitra27-Jun-07 0:03
n_gchaitra27-Jun-07 0:03 
AnswerRe: Mid function.......... Pin
SHatchard27-Jun-07 0:14
SHatchard27-Jun-07 0:14 
GeneralRe: Mid function.......... Pin
n_gchaitra27-Jun-07 2:22
n_gchaitra27-Jun-07 2:22 
AnswerRe: Mid function.......... Pin
Craster27-Jun-07 1:35
Craster27-Jun-07 1:35 
QuestionHow to sort data in datagrid? Pin
Amit Sk Sharma26-Jun-07 23:58
Amit Sk Sharma26-Jun-07 23:58 
AnswerRe: How to sort data in datagrid? Pin
rahul.net1127-Jun-07 0:31
rahul.net1127-Jun-07 0:31 
QuestionIFrames in ASP.NET Pin
J Liang26-Jun-07 23:31
J Liang26-Jun-07 23:31 
AnswerRe: IFrames in ASP.NET Pin
SHatchard27-Jun-07 0:06
SHatchard27-Jun-07 0:06 
GeneralRe: IFrames in ASP.NET Pin
J Liang28-Jun-07 17:58
J Liang28-Jun-07 17:58 
QuestionValidating TextBox with Javascript generated value Pin
ZeedijkMike26-Jun-07 22:37
ZeedijkMike26-Jun-07 22:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.