اخواني كيف امرر اسماء البرميترات فى هذة الFuncation
using System;
using System.Data.SqlClient;
using System.Collections;
namespace SimpleStoredProcedure
{
/// <summary>
/// Summary description for SimpleStoredProcedure
/// </summary>
public class SimpleStoredProcedure
{
private string myConnectionString;
private SqlConnection Connection;
private SqlCommand comm;
private SqlParameter samparam;
public SimpleStoredProcedure(string ConnectionString)
{
myConnectionString = ConnectionString;
Connection = new SqlConnection(myConnectionString);
comm = new SqlCommand();
samparam = new SqlParameter();
}
/// <summary>
/// Executes a StoredProcedure with it's defined parameters
/// </summary>
/// <param name="StoredProcedure">Name of the StoredProcedure to execute</param>
/// <param name="tableName">Name of the table that the StoredProcedure uses</param>
/// <param name="ParamName">Name of the parameters with it's associated value</param>
/// <returns>A dataReader object containing the result of the SQL StoredProcedure</returns>
public DataSet SQLRET(string StoredProcedure, string tableName, params DictionaryEntry[] ParamName)
{
comm = new SqlCommand(StoredProcedure);
comm.CommandType = CommandType.StoredProcedure;
foreach (DictionaryEntry paramV in ParamName)
{
comm.Parameters.AddWithValue(paramV.Key.ToString(), paramV.Value);
}
SqlDataAdapter resultDA = new SqlDataAdapter();
resultDA.SelectCommand = comm;
resultDA.SelectCommand.Connection = Connection;
Connection.Open();
try
{
DataSet resultDS = new DataSet();
resultDA.Fill(resultDS, tableName);
}
finally
{
Connection.Close();
}
return resultDS;
}
}
}تمرير القيم فى كود vb.net in asp.net
Partial Class Stor
Inherits System.Web.UI.Page
Dim SP As New SimpleStoredProcedure
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
SP.SQLRet("Stor1","Test",("@name))
End Sub
End Class
السؤال هناك خطا فى تمرير البارميتر وقيمتة كيف امرر قيم params DictionaryEntry واين اضع قيمة Value للبرميترات
SP.SQLRet("Stor1","Test",("@name