Try this:
1. Open your web.config file and in the <ConnectionStrings> section add the following:
<connectionStrings>
<clear/>
<remove name="LocalSQLServer"/>
<add name="YOURPREFERREDCONNECTIONSTRINGNAME" connectionString="Data Source=YOURDATASOURCE;Initial Catalog=DATABASENAME;User ID=USERNAME;Password=PASSWORD" providerName="System.Data.SqlClient"/>
</connectionStrings>
2. Open your code behind file and import the follwing
Imports System.Data.SqlClient
Imports System.Configuration
3. Modify your code to the following
Dim conn As SqlConnection = New SqlConnection()
Dim cmd As SqlCommand = New SqlCommand()
Try
conn.ConnectionString = ConfigurationManager.ConnectionStrings("YOURPREFERREDCONNECTIONSTRINGNAME").ConnectionString
cmd.Connection = conn
cmd.CommandText = "NAMEOFYOURSTOREDPROCEDURE"
cmd.CommandType = CommandType.StoredProcedure
'Pass parameters required by the stored procedure
With cmd
.Parameters.Add(New SqlParameter("@year", Data.SqlDbType.NChar, 10))
.Parameters("@year").Value = "2009-2010"
.Parameters.Add(New SqlParameter("@unit", Data.SqlDbType.VarChar, 50))
.Parameters("@unit").Value = "welding"
.Parameters.Add(New SqlParameter("@ignum", Data.SqlDbType.TinyInt, 2))
.Parameters("@ignum").Value = 1
End With
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
Catch ex As Exception
Response.Write(ex)
End Try