Hello community,
I am working on learning Stored procedures and parameter passing.
This is My VB code.
This is my Stored procedure on a SQL 2005 server.Code:Imports System.Data Imports System.Data.SqlClient Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim nm As String = TextBox1.Text Dim rm As Integer = TextBox2.Text Dim mySqlConnection As SqlConnection = New SqlConnection(getConnectionString) Dim mysqlcommand As SqlCommand = New SqlCommand("InsertNames", mySqlConnection) mysqlcommand.CommandType = CommandType.StoredProcedure mySqlConnection.Open() mysqlcommand.Parameters.AddWithValue("@name", TextBox1.Text) mysqlcommand.Parameters.AddWithValue("@number", TextBox2.Text) mySqlConnection.Close() End Sub Private Function getConnectionString() As String Return "my connection information Bla bla" End Function End Class
THe project is simple 1 form.. two text boxes , 1 holding a name and the other a number. a button to execute the procedure and pass the parms to the sql server to inserrt using a Stored procedure.Code:USE [TestingArea] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [smilbuta].[InsertNames] -- Add the parameters for the stored procedure here @name varchar(50), @number int AS BEGIN SET NOCOUNT ON; INSERT INTO StProc (fName, uRoom) VALUES (@name, @Number) END
The Issue is i get no errors at all.. yet my DB is not updated...




Reply With Quote