In Mysql,
SELECT id FROM table ORDER BY RANDOM() LIMIT 5
this sql can select 5 random rows. How to do this via JPA Query (Hibernate as provider, Mysql database)?
Thanks.
I have got a WCF Data Service based on a LINQ to SQL data provider.
I am making a query "get me all the records between two dates".
The problem is that I want to synthesize two extra records such that I always get records that fall on the start and end dates, plus all the ones in between which come from the database.
Is there a way to "intercept" the request so I can synthesize these records and return them to the client?
Thanks
I'm building an ASP.NET MVC site using the ADO.NET Entity Framework.
I have an entity model that includes these entities, associated by foreign keys:
Report(ID, Date, Heading, Report_Type_ID, etc.)
SubReport(ID, ReportText, etc.) - one-to-one relationship with Report.
ReportSource(ID, Name, Description) - one-to-many relationship with Sub_Report.
ReportSourceType(ID, Name, Description) - one-to-many relationship with ReportSource.
Contact (ID, Name, Address, etc.) - one-to-one relationship with Report_Source.
There is a Create.aspx page for each type of SubReport. The post event method returns a new Sub_Report entity.
Before, in my post method, I followed this process:
Set the properties for a new Report entity from the page's fields.
Set the SubReport entity's specific properties from the page's fields.
Set the SubReport entity's Report to the new Report entity created in 1.
Given an ID provided by the page, look up the ReportSource and set the Sub_Report entity's ReportSource to the found entity.
SaveChanges.
This workflow succeeded just fine for a couple of weeks. Then last week something changed and it doesn't work any more. Now instead of the save operation, I get this Exception:
UpdateException: "Entities in 'DIR2_5Entities.ReportSourceSet'
participate in the 'FK_ReportSources_ReportSourceTypes' relationship.
0 related 'ReportSourceTypes' were found. 1 'Report_Source_Types' is expected."
The debug visualizer shows the following:
The SubReport's ReportSource is set and loaded, and all of its properties are correct.
The Report_Source has a valid ReportSourceType entity attached.
In SQL Profiler the prepared SQL statement looks OK. Can anybody point me to what obvious thing I'm missing?
TIA
Notes:
The Report and SubReport are always new entities in this case.
The Report entity contains properties common to many types of reports and is used for generic queries. SubReports are specific reports with extra parameters varying by type. There is actually a different entity set for each type of SubReport, but this question applies to all of them, so I use SubReport as a simplified example.
Im using a linux machine, and I followed the instructions seen on http://jm2.php.net/manual/en/install.php to setup php, apache and my sql.
I did exactly what it said and nothing more, but when I try to open a .php file with firefox or chrome, it downloads...?
Im following a tutorial on learning php seen here: http://devzone.zend.com/node/view/id/625
Is there something im not doing or doing wrong?
All answers are appreciated.
How do I get wildcard text searches (like SQL's "like" statement) in ASP.net MVC using the edo entity framework?
I assumed this would work:
var elig = (from e in _documentDataModel.Protocol_Eligibility_View
where e.criteria.Contains(query)
select e);
But it returns no results even when searching for a query string that's definitely in the database. What am I doing wrong?
GUID is not an official data type in database. In our existing SQL Server design, the Uniqueidentifier type is used for GUID value. Now we are switching to Sybase database. Should we use varchar(36) to replace that Uniqueidentifier type?
I am still confused by GUID. I was told GUID is 16 bytes long but its character string is 36 characters in length. I must missed something.
I'm playing around with db4o, and I have the Object Manager viewer thingy for Visual Studio. It seems okay, but not exactly on par with tools like HeidiSQL/SQL Studio/etc., not to mention that it locks the db4o file--I can't use my db4o app and Object Manager at the same time.
Maybe I'm using it wrong, but regardless, I'd like to know what else is out there. What tools would you recommend for looking at and manipulating db4o files?
I have a standard template "ASP.NET MVC 2 Web application" solution, an empty (meaning no data inserted, but with all tables etc. ready and waiting) SQL Server database, an Entity Framework 4 model (edmx). Is there a way to generate simple CRUD controllers and form views for all the entities in the model?
I need to design a notifications framework written solely in .Net. I was wondering is there were some libraries already available to ease in creating rules for the notifications.
PS: Anything other than SQL Server Notifications please.
Note: Notifications as in Emails and SMS notifications.
I have three records in a table
example:
*Usernames* *email* *city*
Nick [email protected] London
Vikky [email protected] Paris
Lisa [email protected] Sydney
Now I want to get specific record keeping email ID as a key ,
SQL query may be like this
select * from table1 where email = "[email protected]"
What is the equivalent GQL query for the above ??
I have just installed the GDR RTM version of Visual Studio Team System Database Edition GDR RTM.
It all seems to work wonderfully, but I seem to have to edit XML (Database.sqlpermissions) for specify SQL Permissions.
Am I missing something?
For that matter where is the schema diagram tool?
I understand GDR exposes alot for extending the Database Edition components, so am I supposed to wait for third party extensions to provide the diagram tool and permissions designer?
What I need: A TFS 2010 Setup that allows 2 application developers to access the TFS from remote locations.
How it is setup:
Server 2008 Standard
2g Ram
300g HD space
SharePoint Server 2007, using SQL Server 2005
SQL Server 2008 Standard
Team Foundation Server 2010
IIS 7
Sharepoint Bindings: TFS.DynAccount.Me:80; TFS:80
TFS Bindings: TFS.DynAccount.Me:8080; TFS:8080
Using DynDNS service to account for the dynamic ip address being used, this is a requirement for the moment until I can get a better isp package.
Access using Local Accounts
Server is not setup on a domain, or as a domain.
Consequently I did not setup AD services.
Problem:
When logged into TFS using my credentials TFS\AdminUser through the DynDNS account TFS.DynAccount.Me I recieve the 'Red X of Death' on the Documents and Reports folder.
When logged into the TFS through the local peer to peer network using the same credentials TFS\AdminUser I do not receive the 'Red X of Death' problem.
Further Troubleshooting:
When users 'Right Click' the 'TeamProject1' Click 'Show Project Portal' it tries to take them to http://TFS:8080 instead of http://TFS.DynAccount.Me:8080, which doing further research I am assuming that it is because team foundation server was setup with a local name of TFS instead of 'TFS.DynAccount.Me' as specified here in Visual Studio Magazines: The Red X of Death.
Users can Access the Team Portal for SharePoint via http://TFS.DynAccount.Me/TeamCollection/TeamProject so it is not like we are dead in the water or anything. However, as most employees/staff are prone to do, they have expressed a great distaste for having to do it this way and just be patient until the current project is finished since we are under a very strict deadline.
Is there a way to set this up differently, or change some settings someplace, reinstall it, point a CName record for our domain website to the DynAccount (e.g. TFS.OurDomain.com points to TFS.DynAccount.Me, which consequently does allow access to the http site without issues), or something. I really don't feel like after all the time and effort I have spent into, first the cost, second the bloody install, third learning SharePoint well enough, fourth the hours into days spent on this, fifth more troubleshooting, sixth employee headaches to just let it lay where it is at.
I figure in my spare/off time I would keep trying to get this to work. So I really appreciate any help any one can give me. I know this is probably something really stupid simple that I will 'Face Palm' over, but at the moment the stress and frustration just has me beat.
Thank you again, this community has always been a great help.
The Android SDK has some convenience methods for manipulating data with SQLite. However both the insert and replace methods use some nullColumnHack parameter which usage I don't understand.
The documentation explains it with the following, but what if a table has multiple columns that allow NULL? I really don't get it :/
SQL doesn't allow inserting a completely empty row, so if initialValues is empty this column [/row for replace] will explicitly be assigned a NULL value
I am converting a personal site over to MVC 2 and I have been using Forms Authentication against a SQL Server DB. Curious if the standard MVC 2 template will just automatically work if I upload it to the server. I have added the connection string to the web.config. I'm thinking it will work but wanted to see if anyone's done this.
I'm hearing that is better to have one connection open upon app start up and closing it when the app shuts down.
What kind of issue can occur having multiple connections ?
Any articles out there that it is best practices to have one connection?
What are your experience with sql ce?
Coming for using Sql Server where there are file-groups, i was wondering if there is (i'm sure there is) something similar in MySQL. After all the database cant be limited to just one hard drive( if using windows that is). I've tried to search but its hard to find the something that you don't know the name of!.
I didn't find much data about the internals of PL/Scope.
I'd like to use it to analyze identifiers in PL/SQL scripts. Does it work only on Oracle 11g instances? Can I reference its dlls to use it on a machine with only ORACLE 9/10 installed?
In a related manner, do I have to execute the script in order to its identifiers to be analyzed?
Hello!:-) My new Problem is the following: An sql-query to a database (DB2) returns 1500 rows but BIRT shows me only 500 in the dataset-editior. To count them i used a computed column (Integer) with the following logic:
Total.count(row["VPK"]) I'm using the RCP-Designer (BIRT 2.1.3). How can i get the other rows as well?
Patrick
This is a query I am doing with mysql using PHP
This is the query line
<?php
$query = "SELECT * FROM node WHERE type = 'student_report' AND uid = '{$uid}' LIMIT 1 ORDER BY created DESC";
?>
I get the following error
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 'ORDER BY created DESC' at line 1
I have an html page were i can fill in some text and send (with javascript) this to an sql-database.
On my pc, everything works fine, but on another one (a french windows), it doesn't save my chars correctly.
french chars like é, è, â,.. were saved as 'É', or something like that.
I googled a lot but still did not found any solution, i'm also not able to reproduce the problem on my own pc..
SELECT Question.userid, user.uid
FROM `question`
WHERE NOT `userid`=2
LIMIT 0, 60
INNER JOIN `user`
ON `question`.userid=`user`.uid
ORDER BY `question`.userid
returns Error:
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 'INNER JOIN User ON question.userid=user.uid ORDER BY question.userid' at line 5
Can't for the life of me figure out what I'm doing wrong here.
Dear all:
I'm new to MySQL, and I have a question about the memory.
I have a 200mb table(MyISAM, 2,000,000 rows), and I try to load all of it to the
memory.
I use python(actually MySQLdb in python) with sql: SELECT * FROM table.
However, from my linux "top" I saw this python process uses 50% of my memory(which is total 6GB)
I'm curious about why it uses about 3GB memory only for a 200 mb table.
Thanks in advance!
Hi,
I want to start using Bing for a project which will include working out the shortest route between points, and plotting a route on the map, etc.
However, along with Bing Maps, there is VirtualEarth and MapPoint. How do all these products relate to each other? If I use one, do I need all the others?
Also, does Bing Maps use SQL Server and its spatial/map features?
Thanks
Hi there!
I can't understand if we have linq to sql is there any benefits of using subsonic's active record because thay are similar (table=class).
and sorry for offtop but does it support Oracle or DB2?
Thanks!
Victor.
i have created an exe from py2exe. After successfully creating the exe, i got the following error when i run main.exe.
File "_mssql.pyc", line 12, in <module>
File "_mssql.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.
I am using pymssql module for sql server.