Showing posts with label process. Show all posts
Showing posts with label process. Show all posts

Monday, March 26, 2012

Help Filling Dataset

I have a class that works fine using the SQLDataReader but when I try and duplicate the process using a Dataset instead of a SQLDataReader it returnsa a null value.

This is the code for the Method to return a datareader

public

SqlDataReader GetOrgID()

{

Singleton s1 =Singleton.Instance();

Guid uuid;

uuid =

newGuid(s1.User_id);

SqlConnection con =newSqlConnection(conString);

string selectString ="Select OrgID From aspnet_OrgNames Where UserID = @.UserID";

SqlCommand cmd =newSqlCommand(selectString, con);

cmd.Parameters.Add(

"@.UserID",SqlDbType.UniqueIdentifier, 16).Value = uuid;

con.Open();

SqlDataReader dtr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

return dtr;

This is the code trying to accomplish the same thing with a Dataset instead.

publicDataSet organID(DataSet dataset)

{

Singleton s1 =Singleton.Instance();

Guid uuid;

uuid =

newGuid(s1.User_id);

string queryString ="Select OrgID From aspnet_OrgNames Where UserID = @.UserID";

SqlConnection con =newSqlConnection(conString);

SqlCommand cmd =newSqlCommand(queryString, con);

cmd.Parameters.Add(

"@.UserID",SqlDbType.UniqueIdentifier, 16).Value = uuid;

SqlDataAdapter adapter =newSqlDataAdapter();

adapter.SelectCommand = cmd;

adapter.Fill(dataset);

return dataset;

}

Assume that the conString is set to a valid connection string. The Singlton passes the userid in from some code in the code behind page ...this functionality works as well.

So assume that the Guid is a valid entry..I should return a valid dataset but its null.

Additionally if I change the sql query to just be Select * From aspnet_OrgNames I still get a null value...I am assuming I am doing something wrong trying to fill the dataset.

Any help would be appreciated.

Hi,

Are you passing in a valid dataset which is not null?
include a ' dataset = new DataSet(); ' before you fill in the data and check if it works
if it does, it just means you passed in a null value...

|||

Thank you, Thank you, Thank you!!!

VERY MUCH APPRECIATED!!!

Friday, March 9, 2012

Help - the replication Failed to Run

error i get from replication when i force them to run the process.
mircosoft sql - DMO(ODBC sql state:42000)
Error 14258: Cannot perform this operation while sqlserveragent is
starting.try again.
But i not restart any sqlserveragent And the sql server servies manager show
that all running.
hope can get asnwer as soon as posible .
thanks.
does this help?
http://support.microsoft.com/default.aspx/kb/303287
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"sam" <sam@.discussions.microsoft.com> wrote in message
news:04A2D6ED-C57E-49EF-8952-50E082F5109F@.microsoft.com...
> error i get from replication when i force them to run the process.
> mircosoft sql - DMO(ODBC sql state:42000)
> Error 14258: Cannot perform this operation while sqlserveragent is
> starting.try again.
> But i not restart any sqlserveragent And the sql server servies manager
> show
> that all running.
> hope can get asnwer as soon as posible .
> thanks.