"No database selected" when running procedures - mysql

Hello there I am new to all of this and recently took over my cricket teams website. I have been doing this procedure for 3 month without any problem but today this happened when I ran this query in the SQL section:
CALL refresh_batting_profile_snapshot(#rc);
CALL refresh_bowling_profile_snapshot(#rc);
CALL refresh_mvp_snapshot();
CALL refresh_mvp_derived_moms();
The error message I got back was this:
CALL refresh_batting_profile_snapshot(#rc)
);
MySQL said:
1046 - No database selected

You should have a database list in the left pane. Click on the one you want to use in order to select it:
One you do that, the SQL pane will reflect the currently selected database:

Related

How do I create a Microsoft's Access field within Delphi using code

I am currently working on a Bed and Breakfast management system. I want to create a Microsoft access field in Delphi using code. The field name I want to create is rooms, I want the data type to be text and I want the size to be 6. I found some code on a stack overflow post but not everything. I dont know what to put in the brackets.
//Adds the field to the ms access database
Adotable2.fielddefs.add()
It is quite simple to add a field to an Access table, provided no app has the table open at the time. However, using FieldDefs.Add is not the way to do it, because it does something else which isn't relevant to this task.
Assuming your Delphi form (or datamodule) has an AdoTable1 set up to access the table you want to alter, and that the table's name in the Access database is 'Hotels', this will add the Rooms column to it:
procedure TForm1.Button1Click(Sender: TObject);
begin
if AdoTable1.Active then // close the Hotels table if AdoTable1 accesses it
AdoTable1.Close;
try
AdoConnection1.Connected := True;
AdoConnection1.Execute('alter table Hotels add column rooms text(6)');
finally
AdoTable1.Open;
end;
end;
Note: My AdoConnection1 is set up to access the database using the 'Microsoft Office 16 Access Database Engine OLE DB Provider'.
Btw, if you use "persistent fields" in your AdoTable (the list of fields you get if you right-click on it and select 'Fields Editor ...' from the pop-up menu, you will need to add the Rooms field to it. If you don't use persistent fields, you don't need to worry about this.
The FieldDefs.Add you mentioned is for adding a field in your Delphi app to e.g. AdoTable1 if, for some reason, it did not already include it, for example if you added the field to the table using the MS Access app.

EditRecord failed because of the default alias Error

I have a simple form in access which contains a macro that saves the edit time and a flag after the current record is updated.
However when the macro attempts to execute I get an error that says:
EditRecord failed because the default alias represent a record which is read only
I have been searching over the internet for an answer but I haven't been able to find anything yet that helps.
This form only has one user on it at a time and none of the other forms using the same table are open while it's being used.
I have pk and it's an Auto Increment without duplicate values. Beside this I have changed the locking status to No Lock
I also get an error when I use DoCmd in my macro instead of openQuery.
The data mode in openQuery is "Edit" so it doesn't create any errors.
I'm using the Macro Tools in Access 2016. I'm not sure about the differences between an Access Macro and Access VBA but this is an Access Macro.
Here is the code I have so far:
SetWarning Off
Repeat Count:1
Open Query:
UPDATE table
SET editDate = now, reviewDate = now, flag = 0
WHERE ID=[Forms]![FormName].[ID];
view: Datasheet
Data Mode: Edit
GoToRecord: Next

mysql event scheduler displays error: 'database not selected'

I apologize if this question seems mundane, but I couldn't find a suitable answer on the web. It's my first time working with event scheduler in phpmyadmin and I think I've got the syntax down:
CREATE EVENT `zero_my_column`
ON SCHEDULE EVERY
1 MINUTE STARTS '2017-07-21 19:02:00'
DO BEGIN
UPDATE
`runners`.`run`
SET
`weekly_total` = 0
WHERE
`weekly_total` <> 0
END;
However, when I run this query in my localhost/phpmyadmin page I get the following error: #1046 - No database selected. runners is my database and run is my table. I am trying to reset the weekly_total column to zero. I'm wondering if the error arises because I need to enter validation to access the database, but I'm unsure. Any tips/hints are much appreciated.
I finally figured it out:
To create an event
Go into phpmyadmin
go to the database you will schedule the event for
click on Events tab
Then enter the script to schedule the event

SmartFoxServer Basic user leaveRoom error

User 1 is opening the application from Flash and user 2 from browser
User 1 creates room A
User 2 joins room A
User 2 exits room A
... and I get this error:
[ RECEIVED ]: <msg t='sys'><body action='uCount' r='2' u='1'></body></msg>, (len: 60)
[ RECEIVED ]: <msg t='sys'><body action='userGone' r='89'><user id='91' />, (len: 73)
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at it.gotoandplay.smartfoxserver.handlers::SysHandler/handleUserLeaveRoom()[/Users/Lapo/Documents/Flex Builder 2/SmartFoxClient_AS3/src/it/gotoandplay/smartfoxserver/handlers/SysHandler.as:353]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at it.gotoandplay.smartfoxserver.handlers::SysHandler/handleMessage()[/Users/Lapo/Documents/Flex Builder 2/SmartFoxClient_AS3/src/it/gotoandplay/smartfoxserver/handlers/SysHandler.as:84]
at it.gotoandplay.smartfoxserver::SmartFoxClient/xmlReceived()[/Users/Lapo/Documents/Flex Builder 2/SmartFoxClient_AS3/src/it/gotoandplay/smartfoxserver/SmartFoxClient.as:327]
at it.gotoandplay.smartfoxserver::SmartFoxClient/handleMessage()[/Users/Lapo/Documents/Flex Builder 2/SmartFoxClient_AS3/src/it/gotoandplay/smartfoxserver/SmartFoxClient.as:1418]
at it.gotoandplay.smartfoxserver::SmartFoxClient/handleSocketData()[/Users/Lapo/Documents/Flex Builder 2/SmartFoxClient_AS3/src/it/gotoandplay/smartfoxserver/SmartFoxClient.as:1401]
If user 2 creates room A
User 1 joins room A
User 2 exits room A
... there is no error when user 2 exits room.
So, I have a button that connects user to server, when user is connected and joined the "lobby" room he can join and create rooms, when 2 players joined, game begins.
I am using SFS Basic with AS3, I don't call getRoomList() anywhere and I need to mention that I have another application similar to this that is working without error (same api, same server, similar function flow).
Tried different solutions, but no help...
I don't understand why I get this error on this application and the other one works fine and why do I get this error only when I create the room and I expect to get an error when any user creates room, not only when user 1 creates the room.
Any help or suggestions are greatly appreciated, I'm struggling with this problems for days...
Update:
If I create a 3 players room (game room) and the game is not started and I connect 2 players and then they disconnect everything is fine, but if the game starts and then they disconnect I get this error.
I found the problem and I hope I save someone some time with this answer:
The problem was this line:
sfs.getActiveRoom().getUserList().sort(randomize)[0].getName();
I was using this code to generate a random user to be the first to play, but actualy it seems that I was changing the user list array (by sorting it) (sfs.getActiveRoom().getUserList()) and when the user was leaving the room. Boom! Error! Null Object!
So, I changed with this:
var userList:Array = new Array();
userList = userList.concat(sfs.getActiveRoom().getUserList());
var randomUser = userList.sort(randomize)[0].getName();

Error 3078 "cannot find table" in MS Access from external ODBC-linked table

Within my Access 2010 form I have the ability to add records, but before one adds a record, we need the ability to check if the business unit, year, and quarter already exists within the SQL table before new record is being written.
The three things I need to confirm are the fields in my form called [BU_Selected_Add], [Qtr_Add] and [Year_Add] in the SQL table "tTbl_ADMIN_RxREBATE" within their respective fields:
[GL_BU], [Year], and [Quarter].
So I started with a simple Business_Unit dlookup below:
If DLookup("[GL_BU]", "tTbl_ADMIN_RxREBATE", "[GL_BU] = '" &
Me!BU_Selected_Add & "'") > 0 Then
MsgBox "This Business Unit already exists within the data below!"
I get the following error:
Run-time error '3078': The Microsoft Access database engine cannot find the
input table or query "tTbl_ADMIN_RxRebate". Make sure it exists and that its
name is spelled correctly.
It most certainly exists in the SQL Server 2008 R2.
I need to get this first part right before adding in whether that [BU_Selected_Add] was added during the year and quarter within the fieldboxes called [Qtr_Add] and [Year_Add].
SELECT dbo_tTbl_ADMIN_RxREBATE.MSID, dbo_tTbl_ADMIN_RxREBATE.DateAdded, dbo_tTbl_ADMIN_RxREBATE.Qtr, dbo_tTbl_ADMIN_RxREBATE.Year, dbo_tTbl_ADMIN_RxREBATE.Rpt_Date, dbo_tTbl_ADMIN_RxREBATE.SRVC_TYP_CD, dbo_tTbl_ADMIN_RxREBATE.GL_BU, dbo_BU_Description.[BU Description], dbo_tTbl_ADMIN_RxREBATE.PY_FNL_PICK_AMT, dbo_tTbl_ADMIN_RxREBATE.PY_FNL_MRGN_AMT, dbo_tTbl_ADMIN_RxREBATE.PY_IBNR_AMT, dbo_tTbl_ADMIN_RxREBATE.CY_FNL_PICK_AMT, dbo_tTbl_ADMIN_RxREBATE.CY_FNL_MRGN_AMT, dbo_tTbl_ADMIN_RxREBATE.CY_IBNR_AMT
FROM dbo_tTbl_ADMIN_RxREBATE INNER JOIN dbo_BU_Description ON dbo_tTbl_ADMIN_RxREBATE.GL_BU = dbo_BU_Description.BU
WHERE (((dbo_tTbl_ADMIN_RxREBATE.Qtr)=[Forms]![Frm_Main]![Frm_Main_Combo_Qtr]) AND ((dbo_tTbl_ADMIN_RxREBATE.Year)=[Forms]![Frm_Main]![Frm_Main_Combo_Year]));