i have things that requires processing and rarely changes except with certain events to take advantage of memcached. can i store a serial version of an object in a data field quickly?
[HttpPost]
public void Test(HttpPostedFileBase file)
{
UsersContext db = new UsersContext();
byte[] image = new byte[file.ContentLength];
file.InputStream.Read(image, 0, image.Length);
CrimeReport i = new CrimeReport
{
ImageId=1, ImageName="Anjli",ImageContent = image,
Active=true
};
db.CrimeReports.Add(i);
db.SaveChanges();
}
I am getting an exception on db.CrimeReports.Add(i);
Recently a software application we utilize upgraded from ASP to ASP.NET. In the process they abandoned the old web-based product and rewrote the entire UI, using new DB tables. The old DB tables still exist in the database and contain legacy files in binary or blob formats. I'm wondering if there is an easy way to export all these legacy files from the database to the filesystem (NTFS)? Then we could delete these old unused tables and save a few GB of space in the DB backups, etc.
I am planning to make a railway reservation project...
I am maintaining following tables:
trainTable
(trainId,trainName,trainFrom,trainTo,trainDate,trainNoOfBoogies)...PK(trainId)
Boogie
(trainId,boogieId,boogieName,boogieNoOfseats)...CompositeKey(trainId,boogieId)...
Seats
(trainId,boogieId,seatId,seatStatus,seatType)...CompositeKey(trainId,boogieId,seatId)...
user
(userId,name...personal details)
userBooking
(userId,trainId,boogieId,seatId)...
Is this good design?
I have my table columns set like this:
likes(id, like_message, timestamp)
id is the primary key that is auto incrementing. This is the SQL that I use to add a row:
$sql = "INSERT INTO `likes` (like_message, timestamp)
VALUES ('$likeMsg', $timeStamp)";
Everything works, but now I need to throw back the id attribute of the newly inserted row. For example, if I insert a row and the id of that row is 13, I need to echo out 13 so my AJAX request can pick that up and use it.
Any help would be appreciated, as well as related code samples. Thanks :)
hi. my tool is in asp. i am using this code for a query in sql
dim req_id
req_id=Request.Form("Req_id")
if req_id<>"" then
Set conn=server.CreateObject("adodb.connection")
conn.Open session("Psrconnect")
Set rs=CreateObject("Adodb.Recordset")
rs.Open "select * from passwords where REQ_ID='"&req_id&"'", conn
i want to put the results of this query into a drop down list. how do i do it? any help is very much appreciated.
I'm trying to learn SQL to store the data rather than reading the file and populating the whole data structure in memory. would it be like reading the data from disk instead of direct memory?
We need to INSERT 2000 records into SQL DB from C# .Net code.
For this is there any way to INSERT all 2000 records at a time instead of executing the INSERT query for each record.
Also how would be the performance impact of doing this?
Thanks & Regards
Padma
I have been using DabbbleDB online database for storing/retrieving values for one of my iPhone applications.
I am using their JSON response for retrieving the records.
The problem that I am facing is that if there are a large number of records in the database, it takes a long time to get the response from the server and then to parse the JSON response.
Instead I would like to to get a set of records at a time and run a loop to fetch all the records in background.
I do not know whether we can query for a set of records at a time from online databases like DabbleDB.
Anybody having an idea, please help.
We are a growing network but we figured we want to keep that the User only would need one account in order to access the network different sites. (Similar to Stackoverflow's login, If you login in to another "site" you use your account credentials and than your account is created). We want our own login system (Username, password) and not OpenId, as we'd probably have that in the future, but the main focus right now is the global login.
How can I do this? Do a Curl request and send back a cookie? Have a "database" just for the login procedure and on first login also create a new "User" in the site specified database?
Suggestions?.
We have just had a graduate join the team with the end aim of assisting out our very busy DBA.
He has only a basic SQL knowledge from his degree so we are looking for a really good getting started book preferably based on MS SQL server.
Purchase Update: Thanks to the replies we have now purchased Head First SQL to review what he already knows and Beginning SQL Server 2005 Programming to enhance these skills.
Further down the page you can see my full review of the books for our needs. However still feel free to post more books as others may find them useful!
Hi. I'm building a simple app and trying to test DB result output. But unfortunately all I'm getting is an array of size 0. Here's the controller code excerpt:
$data['query'] = $this->db->query('SELECT role_id, role_privilege FROM role');
$this->load->view('welcome_message', $data);
And a view code excerpt:
<?php
echo count($query->result_array())."<br/>";
foreach ($query->result() as $row){
echo $row->role_id . '<br/>';
echo $row->role_privilege . '<br/>';
}
echo 'Total result '.$query->num_rows();
?>
And what I get is next:
0
Total result
Running query from a command line gives a 2 rowed output. Can someone point out what i'm missing?
I'm creating a members site, and I'm currently working on the user Preference settings. Should I create a table with all the preference fields (about 17 fields) or should I include them in the main member table along with the account settings?
Is there a limit as to how many fields I should have in a table? currently the member table has about 21 fields... not sure if its okay to add another 17 more fields when I can easily just put them in another table. It'll take more coding to pull up the data though... any sugguestions?
I am developing an App in which I need to authenticate password, store user personal information and setting details / preferences. All these are user-mobile specific or rather App specific and are unique for each user,the password and settings info should not be lost once phone is switched off or user exits the App, which data storage rocedure is recommended for such App?
How can I access SMS.db file in my iPhone. I want to make an XML document and send it to my server. I am getting problem in fetch data from var/mobile/Library/SMS/sms.db. I can fetch data from resource folder. My iPhone is jail-broken.
Thanks
I'm playing around with the new Web SQL databases. Is there a way to return results from a SELECT statement? Here's my example:
function getTasks (list) {
db.transaction(function (tx) {
list = list || 'inbox';
tx.executeSql("SELECT * FROM tasklist WHERE list = ?", [list], function (tx, results) {
var retObj = [], i, len = results.rows.length;
for ( i = 0; i < len; i++ ) {
retObj[i] = results.rows.item(i);
}
return retObj;
});
});
}
The getTasks function is returning before the success callback does; is there a way to get the results out of the executeSql method, or do I have to do all the processing within the callback?
I have a small Grails application that has the following domain:
class Meal {
String name
String description
String allergyNote
}
For localization purposes the three strings should now be available in multiple languages. For example, while an English user would see name="Steak", a Spanish user should see name="Filete" in the output. I was thinking of doing the following:
class Language {
String isoCode
String languageName
}
class TranslatedString {
Language language
String translation
}
but I am not sure how to link the Meals with the TranslatedStrings as it is used for three members, also I would like to use it for other classes (not just Meal) as well (or do I need to have separated tables, i.e. a MealNameTranslated, MealDescriptionTranslated, etc tables?). I know this is probably a stupid question, but I am a beginner and have not been able to figure this out :-(
Hi, I have to use Json objects and Create, Update, delete and retrive the records in asp. if anybody have an example, please help me.
Thanks in advance.
I am trying to create a new Notice Alert using PHP and Javascript. Suppose that a 100 users are currently logged into to the Online Notice Board Application and any One user posts a new notice. I want an immediate alert signal on all the users screen.
I know, that the simplest way of doing it is to constantly Ping the server but I don't want to do it as it will slow down the server.
Moreover, I am on a shared host. So I don't have access to any Socket Port. That means, I cannot establish any direct Socket Communication Channel from the Server to the User Machine.
Can any one suggest me some other solution to this kind of problems???
Hi,
In a single webmethod in .net webservice there are 4 times DB hit (for different tables), apart from using stored procedures, is there any means which i can follow to reduce the db hit?
The python shelf module only seems to be allow string keys. Is there a way to use arbitrary typed (e.g. numeric) keys? May be an sqlite-backed dictionary?
Thanks!