Sqlhelper

Nov 16, 2007

i have part in the code that i want to update row in table

for that i add microsoft dll for sql which is working fine

but i cant any thing wronge in the query that i want..

someone can see whats wronge in the sql query?

 int res = SqlHelper.ExecuteNonQuery(conn, CommandType.Text,@"UPDATE Categories

SET CatParentID = @CatParentID,

CatName = @CatName,

CatOn=cast(@CatOn as bit) Where CatID = @CatID",

new SqlParameter("@CatName",CatName),new SqlParameter("@CatParentID",Convert.ToInt32(CatParentID)),

new SqlParameter("@CatOn", CatOn), new SqlParameter("@CatID",Convert.ToInt32(CatID)));

View 6 Replies


ADVERTISEMENT

SqlHelper.cs For SQL Server Everywhere

Dec 18, 2006

Hi,

my application work with the SQLHelper class. This works fine for the MSDE/SQL Server 2005 Express Edition.

Now I want that my application work with the SQL Server Everywhere DB.

Is there an SQLHelper class out there for SQL Server Everywhere?



Thanks

Günter Hubmann

View 3 Replies View Related

Value Can Not Be Null, Sqlhelper Problem

Mar 22, 2007

Hi Everyone, I am trying to conver this 1.1 site and have completed most of it. However, I am getting the following error: Exception Details: System.ArgumentNullException: Value cannot be null.Parameter name: connectionStringIt is referring to the following line:dr = SqlHelper.ExecuteReader(connectionString, Data.CommandType.Text, sql_stmnt, 1)I am usually a C# guy and have never used SqlHelper before.Here is the complete code and stack trace. Thanks for your help!Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load             connectionString = Application("ConnectionString_ExistingData")            Connection = New SqlConnection(connectionString)            ''sql_stmnt = "SELECT DegreeID,DegreeName FROM tDegrees " 'WHERE JobID=@JobID"            '--->>>Dim sp As SqlParameter = New SqlParameter("@JobID", JobID)            ''dr = SqlHelper.ExecuteReader(connectionString, CommandType.Text, sql_stmnt)            ''While dr.Read            'Edu_Degree1.DataSource = dr            'Edu_Degree1.Items.Add(New ListItem(dr.Item("DegreeName"), dr.Item("DegreeName")))            'Edu_Degree2.Items.Add(New ListItem(dr.Item("DegreeName"), dr.Item("DegreeName")))            'Edu_Degree3.Items.Add(New ListItem(dr.Item("DegreeName"), dr.Item("DegreeName")))            'Edu_Degree4.Items.Add(New ListItem(dr.Item("DegreeName"), dr.Item("DegreeName")))            ''End While            sql_stmnt = "SELECT DegreeMajorID,DegreeMajorName FROM tDegreeMajor order by DegreeMajorName "            dr = SqlHelper.ExecuteReader(connectionString, Data.CommandType.Text, sql_stmnt)            While dr.Read                'Edu_Degree1.DataSource = dr                Edu_Major1.Items.Add(New ListItem(dr.Item("DegreeMajorName"), dr.Item("DegreeMajorName")))                Edu_Major2.Items.Add(New ListItem(dr.Item("DegreeMajorName"), dr.Item("DegreeMajorName")))                Edu_Major3.Items.Add(New ListItem(dr.Item("DegreeMajorName"), dr.Item("DegreeMajorName")))                Edu_Major4.Items.Add(New ListItem(dr.Item("DegreeMajorName"), dr.Item("DegreeMajorName")))                Edu_Major5.Items.Add(New ListItem(dr.Item("DegreeMajorName"), dr.Item("DegreeMajorName")))            End While            sql_stmnt = "SELECT CertificationID,CertificationName FROM tCertifications order by CertificationName "            dr = SqlHelper.ExecuteReader(connectionString, Data.CommandType.Text, sql_stmnt)            While dr.Read                'Edu_Degree1.DataSource = dr                Lic_Code1.Items.Add(New ListItem(dr.Item("CertificationName"), dr.Item("CertificationName")))                Lic_Code2.Items.Add(New ListItem(dr.Item("CertificationName"), dr.Item("CertificationName")))                Lic_Code3.Items.Add(New ListItem(dr.Item("CertificationName"), dr.Item("CertificationName")))            End WhileEnd Sub Stack Trace: [ArgumentNullException: Value cannot be null.Parameter name: connectionString]   Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String connectionString, String spName, Object[] parameterValues) +94   Apply.Page_Load(Object sender, EventArgs e) in C:Documents and SettingsAlain DarwichMy DocumentsVisual Studio 2005WebSitesCBNATS2Apply.aspx.vb:255   System.Web.UI.Control.OnLoad(EventArgs e) +80   System.Web.UI.Control.LoadRecursive() +49   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3749    

View 1 Replies View Related

DAAB ( Sqlhelper ) Problem

May 5, 2007

Hi,
i am using sql 2000 and VS2005 ASP.NET 2.0
i have a problem using sqlhelper although i didn't notice it before (i've use it a lot)
the problem summarize as increasing of the connection (mayb 50+ for one user) which results in an pool size "Overflow"
i navigated the net i found many people speaking of an alternative from microsoft.
  - i would like to know more information about the problem and
  - is it the best alternative or not?
  - and what is the best alternative?
 
          thanx in advance
i would be pleased if you provide me with information

View 1 Replies View Related

Retrieve Multiple Variables From Stored Procedure (SQLHelper)

Jun 22, 2004

Hi all,

I am using SQLHelper to run a Stored Procedure.
The Stored Procedure returns 3 variables:

ie:

SELECT @Hits = COUNT(DISTINCT StatID) FROM Stats

...etc...

The SP is currently called as below:

SqlParameter[] sqlParams = new SqlParameter[]
{
new SqlParameter("@FromDate", Request["FromDate"]),
new SqlParameter("@ToDate", Request["ToDate"]),
};


My question is this: How do I retrieve these variables?

I know I need to declare a new SqlParameter and change it's Direction to Output but I am unsure of the exact syntax required to do this.

Thanks in advance,

Pete

View 5 Replies View Related

Sqlhelper Class Failed To Convert Sql Parameter To A String Error

Oct 17, 2007

I'm getting this error and I'm not really sure what is wrong.  I'm using the sqlhelper class which was writen by microsoft, so I figure the code is right.
 Here is code of me passing in the strings.  Yes I tried puttinga .ToString() on the end of the sqlparameters.
public class LoginSelectData : DataAccessBase{private EndUser _enduser;public LoginSelectData(){    StoredProcedureName = StoredProcedure.Name.VERIFYUSER.ToString();}public DataSet Get(){DataSet ds;LoginSelectDataParameters _loginselectedataParameters = new LoginSelectDataParameters(this.Enduser);DataBaseHelper dbhelper = new DataBaseHelper(StoredProcedureName);ds = dbhelper.Run(base.ConnectionString, _loginselectedataParameters.Parameters);return ds;
}public EndUser Enduser{get { return _enduser; }set { _enduser = value; }}
}
public class LoginSelectDataParameters{private EndUser _enduser;private SqlParameter[] _parameters;public LoginSelectDataParameters(EndUser userinfo){this.Enduser = userinfo;
Build();
}
 private void Build(){
SqlParameter[] parameters = {new SqlParameter("@username",this.Enduser.Username),new SqlParameter("@password",this.Enduser.Password)
};
Parameters = parameters;}public SqlParameter[] Parameters{get { return _parameters; set { _parameters = value; }
}public EndUser Enduser{get { return _enduser; }set { _enduser = value; }}
}

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved