|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Database Access
I wish to enquire about some theory question.
I want to know what is the difference between using Stored Procedure and also The DataAdapter, DataSet... What are the main difference? I just need to know in C#, VB.net and ASP.net usage for Web Application or Form Application differences using Stored Procedure and Data Adapter and stuff. I want to ask one more question: I have been using Statements like this to access my Stored Procedure is it a good practice? #region THIS PART IS FOR GETTING THE SCHEDULE DETAILS FOR THE USER public SchA GetSchedule(string UserNo, string Date) { //STARTING THE DATABASE //This is to establish a connection with the Server string strConnection = "server = Jas;"; strConnection+="database=Fit;uid=sa;password=;"; // Create Instance of Connection and Command Object SqlConnection myConnection = new SqlConnection(strConnection); // Mark the Command as a SPROC (Stored Procedure) SqlCommand newCommand = new SqlCommand("ViewSch", myConnection); newCommand.CommandType = CommandType.StoredProcedure; SqlParameter parameterUserNo = new SqlParameter("@UserNo", SqlDbType.VarChar, 50); parameterUserNo.Value = UserNo; newCommand.Parameters.Add(parameterUserNo); SqlParameter parameterFDate = new SqlParameter("@Sch_date", SqlDbType.VarChar, 50); parameterFDate.Value = Date; newCommand.Parameters.Add(parameterFDate); SqlParameter parameterTime = new SqlParameter("@Sch_time", SqlDbType.VarChar, 50); parameterMessage.Direction = ParameterDirection.Output; newCommand.Parameters.Add(parameterTime); SqlParameter parameterDate = new SqlParameter("@Sch_date", SqlDbType.VarChar, 50); parameterDate.Direction = ParameterDirection.Output; newCommand.Parameters.Add(parameterDate); SqlParameter parameterInfo = new SqlParameter("@Sch_info", SqlDbType.VarChar, 50); parameterInfo.Direction = ParameterDirection.Output; newCommand.Parameters.Add(parameterInfo); myConnection.Open(); newCommand.ExecuteNonQuery(); myConnection.Close(); // Create CustomerDetails Struct SchA Sch = new SchA(); Sch.Sch_date = (string)parameterTime.Value; Sch.Sch_info = (string)parameterDate.Value; Sch.Sch_time = (string)parameterInfo.Value; return Sch; } #endregion NHK |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Database Development > Database Access |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|