Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 113413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:41:54+00:00 2026-05-11T02:41:54+00:00

I was trying to TDD using SubSonic 2.1, MySQL and C# and when I

  • 0

I was trying to TDD using SubSonic 2.1, MySQL and C# and when I got to testing updating an existing record using the code below,

public void Test2() {     User.Insert('jmarcus1', 'jmarcus1', 'jackass', 'marcus', 3, false);     User users = new User();     int ulevel = 1;     User.Update(2, 'jmarcus1', 'jmarcus1', 'jackass', 'marcus', ulevel, false);     Assert.AreEqual(1, users.Ulevel); } 

with the following

------ Test started: Assembly: SalMan.dll ------  Starting the MbUnit Test Execution Exploring SalMan, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null MbUnit 2.4.2.130 Addin Found 3 tests [success] TestFixture1.Test [success] TestFixture1.Test1 [failure] TestFixture1.Test2 TestCase 'TestFixture1.Test2' failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `userid` = 1; SELECT 1 AS id' at line 1     MySql.Data.MySqlClient.MySqlException     Message: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `userid` = 1; SELECT 1 AS id' at line 1     Source: MySql.Data     StackTrace:     at MySql.Data.MySqlClient.MySqlStream.OpenPacket()     at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)     at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()     at MySql.Data.MySqlClient.MySqlDataReader.NextResult()     at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)     at MySql.Data.MySqlClient.MySqlCommand.ExecuteScalar()     C:\svn\subsonicproject\trunk\SubSonic\DataProviders\MySqlDataProvider.cs(280,0): at SubSonic.MySqlDataProvider.ExecuteScalar(QueryCommand qry)     C:\svn\subsonicproject\trunk\SubSonic\DataProviders\DataService.cs(533,0): at SubSonic.DataService.ExecuteScalar(QueryCommand cmd)     C:\svn\subsonicproject\trunk\SubSonic\ActiveRecord\ActiveRecord.cs(182,0): at SubSonic.ActiveRecord`1.Save(String userName)     D:\My Documents\Visual Studio 2008\Projects\SalMan\SalMan\Generated\User.cs(352,0): at Salman.User.Update(Int32 varUserid, String varUsername, String varPassword, String varFname, String varLname, Int32 varUlevel, Boolean varStatus)     D:\My Documents\Visual Studio 2008\Projects\SalMan\SalMan\Tests\TestFixture1.cs(40,0): at salman.TestFixture1.Test2()  [reports] generating HTML report TestResults: file:///C:/Documents%20and%20Settings/*****************/Application%20Data/MbUnit/Reports/SalMan.Tests.html  2 passed, 1 failed, 0 skipped, took 7.66 seconds. 

Does anyone have a workaround for this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T02:41:55+00:00Added an answer on May 11, 2026 at 2:41 am

    apparently the solution was, following Robs excellent advice above, to

    User u = User.FetchByID(2); u.Ulevel = ulevel; u.save(); 

    i was not too sure that the snippet above would work for updates until you specify the record you wish to update.

    my question to Rob however is, why does ‘u.Update(2, ‘jmarcus’,…’ give the error above?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to code TDD style in PHP and one of my biggest
I am trying to re-write a method using TDD. Here is the original method
I'm trying to develop a extension ( IExtension<OperationContext> ) for System.ServiceModel.ObjectContext using TDD. The
I'm developing a project using BDD/TDD techniques and I'm trying my best to stay
I have been trying to get the hang of TDD and unit testing (in
I'm trying to get into the unit testing and TDD way of doing things
I am trying to learn TDD/BDD using NUnit and Moq. The design that I
Am trying to get started using TDD on a class which spits out an
I have been looking at using TDD and implementing proper testing (only just started
I am trying to learn and implement TDD specifically using Moq and I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.