Questions tagged [sqlhelper]

SqlHelper class is a utility class that can be used to execute commands in a SQL Server database.

Introduction
The SqlHelper class is a utility class that can be used to execute commands in a SQL Server database. We know ADO.Net methods like SqlConnection,SqlDatAdapter and SqlCommand. To use these methods users typically write repititive lines of code like connecting to a db, executing the queries and finally disconnection from the db, etc. SqlHelper Class helps to reduce the number of lines coded.

Namespace
Microsoft.ApplicationBlocks.Data

Methods
ExecuteDataSet
ExecuteNonQuery
ExecuteReader
ExecuteScalar
ExecuteXmlReader

Syntax
SqlHelper.ExecuteDataSet(SqlConnection connection,string spname,params object[] parameter)

Example

SqlHelper.ExecuteNonQuery(DataAccess.ConnectionString, CommandType.StoredProcedure, "InsertStudent", new SqlParameter ("@RollNo",rollNo), new SqlParameter("@Name",name),new SqlParameter ("@Class",class));

References
http://msdn.microsoft.com/en-us/library/cc467894.aspx
http://www.codeproject.com/Tips/555870/SQL-Helper-Class-Microsoft-NET-Utility

50 questions
6
votes
1 answer

MySQL Error Code: 3948 Loading local data is disabled; this must be enabled on both the client and server sides

I have this code to upload CSV files into MySQL, I tried to upload the CSV files I created, but I keep getting this error when I run the code. The code I'm trying to run is here: Load Data Local Infile '/Users/dylanpowell/Dropbox/Dylan…
Dylan Powell
  • 61
  • 1
  • 1
  • 3
4
votes
1 answer

Timeout issue when using sql helper(Microsoft.ApplicationBlocks.Data)

I am having timeout issues when dealing with long sql queries, the Dataset which timesout for long queries is : static public DataSet Getxxxx(Guid xxxx) { DataSet ds = SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,…
Mr A
  • 6,448
  • 25
  • 83
  • 137
4
votes
3 answers

SQLHelper Class

Is there a recent version of the SQLHelper class out there. I've been using one for a few years now and was wondering if there is a new version out there for .NET Framework 2.0 or 3.0. I prefer this on small projects vs Microsoft Data App Block…
Saif Khan
  • 18,402
  • 29
  • 102
  • 147
3
votes
3 answers

How can i select from table where tablename is specified as SqlParameter?

I am trying to perform dynamic sql select where I am selecting from a table using a parameter. SELECT null FROM @TableName However I am getting error must declare table variable @TableName. I suspect this is because I am selecting from a table…
Valamas
  • 24,169
  • 25
  • 107
  • 177
3
votes
2 answers

SQL: Left Outer join that can switch what columns to join with depending on data inside the column

I'm trying to join these two tables together to show the record in base and the null in history. The problem I am having is with a left outer join. when BO.val2 = 0: I want the join to use BO.VAL5 = TR.VAL5 only but when BO.val2 = TR.val2 I want it…
3
votes
0 answers

How to manage open and close connections of SqlHelper class

I am managing a code and when i had a code walkthrough i found that in many places SqlHelper class was used and i have a question regarding that. In many places connection.open() and connection.close() was not used, i am concerned as not closing…
3
votes
3 answers

Setting CommandTimeout in Microsoft's Data Access Application Block (SQLHelper)

I'm using the Data Access Application Block (SQLHelper) to execute SQL against a database. I have one query which takes longer than the default command timeout of 30 seconds. I want to up the timeout, but I don't see any way to do so without…
Mashmagar
  • 2,556
  • 2
  • 29
  • 38
2
votes
0 answers

Modify data in excel using jxl without creating copy

I'm trying to use an excel file as a database and the app constantly needs to read and modify the file. As explained in this Q&A, it is necessary to create a copy of original excel file and all the modification has to be done there. Is there anyway…
Dante
  • 457
  • 1
  • 5
  • 17
2
votes
2 answers

Pass object parameter to stored procedure by SqlHelper

I have a SQL table like this: ID is Identity column. And I have a class for this table in ASP.Net project like this: public class Topic { public int ModuleID { get; set; } public string Name { get; set; } public string…
Ali Soltani
  • 9,589
  • 5
  • 30
  • 55
2
votes
4 answers

Lightweight ADO.NET Helper Class

Can anyone point me towards a current library that provides basic wrapping of ADO.NET functionality? I'm looking for something along the lines of the old SqlHelper class and am not really interested in using the Data Access Application Block (as…
DanP
  • 6,310
  • 4
  • 40
  • 68
2
votes
2 answers

Android : Adapter is not working with Arraylist of Hashmap

I am trying to show some data offline from SQLite database. Data is coming fine but I am not able to show that on listview with adapter. libraryList.clear(); libraryList = dBhelper.localQuestionBank(student_uuid, questionBankId); if…
2
votes
2 answers

Create a Table using SQLHelper with a variable name in C#

I want to create table with name of username.The username is written in uname.Text textbox in xaml. I am using SQLHelper for this.I think I am having a problem with syntax.Can anyone correct my syntax in the code given…
Amaid Niazi
  • 162
  • 9
2
votes
0 answers

How to set CommandTimeout in SqlHelper.ExecuteDataSet()?

I have a method which uses SqlHelper.ExecuteDataSet(): Private Function UpdateStatusCode(ByVal no As String, ByVal status As String) As Boolean sqlConn = New SqlConnection(Conn) Dim breturn As Boolean Dim param1 As SqlParameter = New…
hendryanw
  • 1,819
  • 5
  • 24
  • 39
1
vote
1 answer

How to assign a value to the next following column based on logic of preceding values in SQL HIVE?

I am trying to find a way to assign a value to the next following column based on logic of preceding values. For example, lets say we have a table with the column temp. If temp goes above as 95 then the table should display as "System Off", if the…
leaner007
  • 17
  • 5
1
vote
3 answers

Regexp expression from Oracle SQL to Big Query

I previously had help here for an Regexp expression in oracle sql which worked great.However, our place is converting to Big Query and the regexp does not seem to be working anymore. In my tables, i have the following data WC 12/10 change FC from 24…
1
2 3 4