locked
mobile database RRS feed

  • Question

  • User-1336640307 posted

    <appSettings>
        <add key="PageSize" value="5"/>
      </appSettings>
      <connectionStrings>
        <add name="" connectionString="Data Source=.;Database=;User ID=sa; Password="/>
      </connectionStrings>

    protected void Application_Start(object sender, EventArgs e)
            {
                Application.Add("PageSize", Int32.Parse(System.Configuration.ConfigurationManager.AppSettings["PageSize"]));
            }

    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Data.SqlClient;
    using System.Linq;
    using System.Web;

    namespace
    {
        public static class
        {
            private static String ConnectionString { get; set; }

            static ()
            {
                ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["TestProjectDBConnectionString"].ConnectionString;
            }

            public static SqlConnection CreateConnection()
            {
                SqlConnection connection = new SqlConnection(ConnectionString);
                connection.Open();
                return connection;
            }

            public static SqlCommand CreateCommand(SqlConnection connection)
            {
                return connection.CreateCommand();
            }



            public static void CreateStoredprocedure(SqlCommand command, String storedProcedureName)
            {
                command.Parameters.Clear();
                command.CommandText = storedProcedureName;
                command.CommandType = CommandType.StoredProcedure;
            }

            public static void AddInParameter(SqlCommand command, String parameterName, SqlDbType paramaterType, Object paramaterValue)
            {
                command.Parameters.Add(parameterName, paramaterType);
                command.Parameters[parameterName].Value = paramaterValue;
                command.Parameters[parameterName].Direction = ParameterDirection.Input;
            }

          

          

            public static int ExecuteNonQuery(SqlCommand command)
            {
                return command.ExecuteNonQuery();
            }


            public static SqlDataReader ExecuteReader(SqlCommand command)
            {
                return command.ExecuteReader();
            }

            public static Object ExecuteScaler(SqlCommand command)
            {
                return command.ExecuteScalar();
            }
           

        }
    }

    Wednesday, August 28, 2013 8:05 AM

All replies

  • User1751268424 posted

    Hi,

    What is the problem?

    Wednesday, August 28, 2013 8:31 AM