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

  • SEARCH
  • Home
  • 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

Ask A Question

Stats

  • Questions 243k
  • Answers 243k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You might gain increased performance by moving some of your… May 13, 2026 at 7:49 am
  • Editorial Team
    Editorial Team added an answer I wrote this and it seems to work, thanks to… May 13, 2026 at 7:49 am
  • Editorial Team
    Editorial Team added an answer I don't see anything wrong with what you've got... sounds… May 13, 2026 at 7:49 am

Related Questions

So I'm a newbie to TDD, and I successfully created a nice little sample
I have a quick little application and wanted to give a try to develop
I'm writing a data structure in C# (a priority queue using a fibonacci heap
I'm trying to learn TDD by applying it to a simple project of mine.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.