Storing And Restoring Graphics
Apr 20, 2007
hi,
i want to draw a bitmap programaticaly and store it to a db.when i try to display it from the db the drawings appear in a black back ground . how can i solve this problem.
i restore the bitmap by using a dataset and data bind contrls from
visual studio designer and codes to draw and store the bitmap is here :
private void button1_Click(object sender, EventArgs e)
{
pictureBox1.Paint+=new PaintEventHandler(pictureBox1_Paint);
pictureBox1.Refresh();
}
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
PaintImage(e.Graphics);
}
private void PaintImage(Graphics gr)
{
int p1 = Convert.ToInt32(textBox1.Text);
int p2 = Convert.ToInt32(textBox2.Text);
int p3 = Convert.ToInt32(textBox3.Text);
Pen myPen = new Pen(Color.Blue);
gr.DrawCurve(myPen, new Point[] { new Point(50, p1), new Point(100, p2), new Point(150, p3) });
}
private void button2_Click(object sender, EventArgs e)
{
Bitmap bmp = new Bitmap(pictureBox1.Width,pictureBox1.Height );
Graphics gr = Graphics.FromImage(bmp);
PaintImage(gr );
MemoryStream stream = new MemoryStream();
bmp.Save (stream, System.Drawing.Imaging.ImageFormat.Bmp );
byte[] bytes = stream.ToArray();
SqlConnection sqc = new SqlConnection("server=farhad;database=graphics_test;integrated security=sspi");
SqlCommand cmd = new SqlCommand("insert graph values(@p1,@p2,@p3,@graph)");
cmd.Connection = sqc;
cmd.Parameters.Add("@p1", SqlDbType.NVarChar);
cmd.Parameters.Add("@p2", SqlDbType.NVarChar);
cmd.Parameters.Add("@p3", SqlDbType.NVarChar);
cmd.Parameters.Add("@graph", SqlDbType.Image);
cmd.Parameters[0].Value = textBox1.Text;
cmd.Parameters[1].Value = textBox2.Text;
cmd.Parameters[2].Value = textBox3.Text;
cmd.Parameters[3].Value = bytes;
sqc.Open();
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
reader.Close();
sqc.Close();
}
View 1 Replies
ADVERTISEMENT
Nov 1, 2000
If you use the file upload HTML form field to insert an image (jpeg, etc.) into an IMAGE datatype column (which is not the problem), how can you pull that data back out and insert it into an HTML document back to an image (jpeg, etc.) format? Is that possible? I simply need to know if there is a way to use cast or convert or whatever so that the binary/hexidecimal data stored in the table can be reassembled as a real picture again.
Thanks in advance!
View 1 Replies
View Related
Dec 15, 2007
Hello all! Im new to SQL2005. If it is possible to see realtime graphs from tables? For example current sales result?
Thanx
View 1 Replies
View Related
May 7, 2007
ok i have intel dual core i have a conflict only in playing a game black hawk down it gives me a run stop error. locks up and has to be restarted. microsoft gave me a fix but when i do the fix it causes me to get a system dump error on the game. i can update my web site do anything else let daughter play her games or do her school work and nothing happens. i was told i needed to set up the dual core so that my programs dont conflict i am a moron when it comes to computers is there a fix for this or i am i just going to have to go back to single core processor for now thanks
View 1 Replies
View Related
Dec 29, 2006
Hello there,I just want to ask if storing data in dbase is much better than storing it in the file system? Because for one, i am currenlty developing my thesis which uploads a blob.doc file to a web server (currently i'm using the localhost of ASP.NET) then retrieves it from the local hostAlso i want to know if im right at this, the localhost of ASP.NET is the same as the one of a natural web server on the net? Because i'm just thinking of uploading and downloading the files from a web server. Although our thesis defense didn't require us to really upload it on the net, we were advised to use a localhost on our PC's. I'll be just using my local server Is it ok to just use a web server for storing files than a database?
View 6 Replies
View Related
Jan 9, 2007
I did a full backup of a db from one server(Express2005) and trying to restore it to a different instance of SQL2005 on the same development machine. (Also had some fulltext columns if that means anything)
Many failures but finally got it to report all was successful except the icon in Object Explorer shows (Restoring...) with no indication of any real activity going on. It's a tiny database with hardly any data in it.
Just not sure what the heck is going on there. It also won't let me into the database until this the (Restoring...) goes away.
Any advice on how to get this thing finished out?
View 3 Replies
View Related
Dec 16, 1999
I need to store a user ID of whoever made the last change to a record in a table. I have added a field with a default set to 'suser_sid()'.
Is it wise to store SID's in a database table if you are using NT authentication? My concerns are that if the user is deleted by the NT system administrator then I lose data integrety also if the database is backed up and restored onto a different machine with different users it won't work at all.
I'd be grateful for any help with this.
Rich
View 1 Replies
View Related
Jan 24, 2007
Hi, can someone help me with this problem. I have recently downloaded VWD and have been playing around with it a bit. I was windering how do I add an image file to a SQL database. I have used SQL in the past but I have never store an image in it. I can add text data and so forth, but I need some pointers into adding images to the sql database. I want to be able to store the images and then retrieve them to a GridView. I have the images in an image folder within the website, but I do not know how to input the reference or link to the images in an sql table.
A quick example, say I have a table called Images, with the following info:imgID (int)imgDesc (varchar(max)imgFile (img)imgTitle (varchar(20))
To input this in sql I would write Insert Into Images (imgDesc,imgFile,imgTitle) Values ("Large fishy", "", "The Big Fish") what would I need to put for imgFile?
I would really appreciate if someone can point me in the right direction.
View 1 Replies
View Related
Feb 21, 2007
hi all, what sql data type should i use to store variable length bit patterns no longer than 30 bits?
View 4 Replies
View Related
Jul 17, 2007
Hi all! I am back with a new problem.
I am designing a database in which the booking is on an hourly basis instead of daily basis. So I want my colums in a table to be like this:
================================ID(PK)Date(In this table I want date only)TimeSlot(in this table I want time only)CourtNo(facility which is to be booked)Booking ID(FK to booking table)================================
The thing is that SQL server donot have a date only format. I am totally stuck on this one, please help! The database which I created will be ideal if I can just store the date!
Regards,
Taimoor
View 7 Replies
View Related
Dec 16, 2007
Hi whats the best way to store an image in SQL, for instance the image of a product, bearing in mind the website will be hosted by a hosting company.
View 4 Replies
View Related
Mar 19, 2008
Hi All,Does anybody know how i can store a paragraph with spaces, newline, empty lines in a sql server 2005 database table? What data type should i declare the table entry to take? I will also like to retrieve the data with what ever i would have stored it with.
View 6 Replies
View Related
Oct 20, 2004
My forms are taking user input, then HtmlEncoding them prior to being stored in the SQL DB. For some reason, SQL is storing quotes as � and it is causing the HTML when decoded in the page to not be rendered properly.
Has anyone come across this issue before?
For example (without encoding for readability):
SQL should store the parsed string as: <a href="someurl" class="main">
but for some reason it's being stored as: <a href=�someurl� class=�main�>.
Thoughts?
View 2 Replies
View Related
Jan 16, 2001
Does anyone have thoughts or know of resources that explain the pro's and con's of storing images in a database versus keeping the image in the file system and just storing the path to the image in the database?
View 1 Replies
View Related
Jun 7, 1999
Hello All!
Can some one give SQL Statement on storing images from disk to the database columns.
Once I store the image how do I test it out that the image is stored correctly?
For example this is what I did
I have a table called table1., field called name
insert into table1(name) values(C:123.bmp)
Is the above statement correct? will it store the file or not?
if it does store them then how do I view them?
Can some one please help me...
Thanks in advance for your help
Venkat
View 1 Replies
View Related
Jun 20, 2006
Hi again.
How do I store in SQL SERVER with 2 decimal places?
I set Data Type to Decimal with Scale set to 4 and Precision 19. But this doesn't work.
Any ideas? Thanks.
View 1 Replies
View Related
Mar 28, 2005
Which datatype supports miliseconds?
View 2 Replies
View Related
Jul 16, 2006
CREATE TABLE [dbo].[blogs] (
[blog_title] [nvarchar] (500) ,
[blog_desc_full] [varchar] (8000) ,
[blogger_name] [nvarchar] (100) ,
[mailid] [nvarchar] (100) ,
[blogid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL ,
[blog_desc] [nvarchar] (125) ,
[cat_name] [varchar] (100) ,
[b_url] [varchar] (250) ,
[b_date] [datetime] NULL ,
[author] [nvarchar] (250) ,
[approval] [char] (1)
) ON [PRIMARY]
GO
using this script i have created my blog table.
and a procedure given below. i am using to insert data in it.
CREATE PROCEDURE SP_BlogAdd
@blog_title nvarchar(500),
@blog_desc_full varchar(8000),
@blogger_name nvarchar(100),
@mailid nvarchar(100),
@blog_desc nvarchar(125),
@cat_name varchar(100),
@b_url varchar(250),
@author nvarchar(250)
AS
INSERT INTO blogs(blog_title, blog_desc_full, blogger_name, mailid, blog_desc, cat_name, b_url,author)
VALUES(@blog_title ,@blog_desc_full ,@blogger_name,@mailid ,@blog_desc ,@cat_name ,@b_url,@author)
GO
now, the problem i m facing is.
i am using varchar datatype for [blog_desc_full] [varchar] (8000).
i want more than this size to store data in it.
please give me some detailed code.
i tried text datatype but i didnt succeed. how to use text datatype.
i replaced with text datatype.but in length i couldnt type. it shows only 16.
Please help me out.
regards,
ASIF
View 1 Replies
View Related
Jul 20, 2012
best way to store questionnaire data in a database.Since different questionnairs have different questions and formats i.e dropdown, radio, checkboxes etc building such a database model becomes highly complex.
I've read that if data schema is complex and higly variable it may be better to use an xml document and store that in a databse. However I dont quite understand how you store xml to a database. Do you simply store the entire structure in something like a nvarchar column or is there some other way to store xml to a database.
If you store the entire structure to the databse then how do you query the content to generate reports.
example xml:
Code:
<survey>
<meta>
<id>sample</id>
</meta>
<questions>
<question id="1" type="singlechoice" page="1">
[code]...
View 3 Replies
View Related
Mar 17, 2004
I use SQL 2K with an Access 2000 project as front end. I have four date fields in a table. The first one should contain a date (eg 20th of February), the second one a starting hour (eg 8:00h), the third one the finishing hour (eg 10:00h) and the fourth should calculate the difference between the second and third column.
So I created four datetime fields. Storing a date in the first column is no problem, but storing only hours doesn't seem to do what I want. When I enter 8:00 from within the Access, it is stored 1/1/1900 8:00 in SQL Server. How can I make sure that the hours are saved with the date of the second column, so either as 8:00 without further information or as eg 20-2-2004 8:00?
View 14 Replies
View Related
Apr 6, 2004
Hello Friends,
How to store newline charecters in sqlserver db. Iam implementing a varchar type attribute.
Regards,
Ch.Praveen
View 1 Replies
View Related
May 21, 2004
how can i store time in my table
1 hr:55 mins:22 secs
View 4 Replies
View Related
Feb 25, 2006
I have a table name "ABCD" When I run a Select statement on this table, it returns 100 rows. I would like to store this 100 records for future.
In future I will have the same table with same sturcture. I want to insert this 100 rows into this table.
Any suggestions.
Thanks in Advance
View 5 Replies
View Related
Jun 14, 2006
i need to store date alone in a new field from the existing field which is stored date along with time.
Eg:
old field: emplogintime (date and time)
new field: emploginday (date)
View 4 Replies
View Related
Sep 5, 2007
Hi,
I'm having a DB designed for me, and I'm inspecting it and wondering what in general is the better way to do this.
We have a product, which we are counting "product views". The DB designer has created columns called "view_today" and "views_alltime".
I specified I wanted a normalized database, I'm thinking this is technically not normalized ? Am I correct ?
Wouldn't it be better to have a query that counted the views off the logging table ? I can't see any advantage to doing it the way its been designed except to save time.
Thanks for any input !
Mike123
View 3 Replies
View Related
Jul 23, 2005
Hello all,I have been working with several databases here that are basically datamarts. A lot of the entities have an attribute that is a particularyear and month. For example, a financial transaction may be posted fora particular month, regardless of the actual date on which it occurred.In this system, these year/month combinations have typically beenstored as integers of the form YYYYMM. My question is, how have othersstored this type of information and what advantages/disadvantages haveyou found to your method?The problem that I have found with the current method is that youcannot easily find the difference between two of these dates. Forexample, 200401 - 200312 = 89 (not 1). Storing the values as datetimes(using the first of the month) allows for DATEDIFF(mm, '2003-12-01','2004-01-01') = 1. Of course, a little extra (and meaningless) data isbeing stored. In case the table sizes makes a difference here due tothe extra data being stored, we are usually talking about over 100Mrows.I don't like the idea of storing the values in two columns (year andmonth) because that does nothing to improve on the ability to performuseful functions on the values and very importantly, the month reallyhas no meaning without the year, so I don't think that it should bestored by itself.Thanks for any advice/insight.-Tom.
View 1 Replies
View Related
Oct 22, 2007
I am writing an app in c#. I will be using the following code to get a number from the user. I had to make the variable a string to prevent any kind of conversion to be required.
string newID;
Console.WriteLine("Enter a new ID");
newID = Console.ReadLine();
Console.WriteLine("The new ID is {0}", newID);
Console.ReadLine();
The ID that this will be collecting will be stored in a SQL Server 2005 Express database. The field in the database is of the type int. Will there be a problem saving this number from the code above into the database? Will there be a problem b/c the datatypes don't match?
..........................................thanks to any willing to help
View 4 Replies
View Related
Jul 16, 2006
CREATE TABLE [dbo].[blogs] (
[blog_title] [nvarchar] (500) ,
[blog_desc_full] [varchar] (8000) ,
[blogger_name] [nvarchar] (100) ,
[mailid] [nvarchar] (100) ,
[blogid] [numeric](10, 0) IDENTITY (1, 1) NOT NULL ,
[blog_desc] [nvarchar] (125) ,
[cat_name] [varchar] (100) ,
[b_url] [varchar] (250) ,
[b_date] [datetime] NULL ,
[author] [nvarchar] (250) ,
[approval] [char] (1)
) ON [PRIMARY]
GO
using this script i have created my blog table.
and a procedure given below. i am using to insert data in it.
CREATE PROCEDURE SP_BlogAdd
@blog_title nvarchar(500),
@blog_desc_full varchar(8000),
@blogger_name nvarchar(100),
@mailid nvarchar(100),
@blog_desc nvarchar(125),
@cat_name varchar(100),
@b_url varchar(250),
@author nvarchar(250)
AS
INSERT INTO blogs(blog_title, blog_desc_full, blogger_name, mailid, blog_desc, cat_name, b_url,author)
VALUES(@blog_title ,@blog_desc_full ,@blogger_name,@mailid ,@blog_desc ,@cat_name ,@b_url,@author)
GO
now, the problem i m facing is.
i am using varchar datatype for [blog_desc_full] [varchar] (8000).
i want more than this size to store data in it.
please give me some detailed code.
i tried text datatype but i didnt succeed. how to use text datatype.
i replaced with text datatype.but in length i couldnt type. it shows only 16.
Please help me out.
regards,
ASIF
View 1 Replies
View Related
Nov 21, 2007
Is there any method to store the MP3 file in database. And also I want free text search in the table? Please help me its important
Thanks in advance
View 3 Replies
View Related
Apr 28, 2006
Hi,
is it possible to
- store a User Defined Function in a table
- find and execute it from a SELECT expression
- using column-data?
Thanks,
View 3 Replies
View Related
Jul 14, 2006
Hi
I am developing a project in asp.net. And i need to store html content in sql server.
Will anybody tell me which datatype should be used for storing html tags in sql server.
for example i want to store <a href="abc.asp">abc.asp</a> in database.
and when I retrive it back from database it should be real html tag and not string.
Thanks
View 1 Replies
View Related
Jan 16, 2007
Hi everyone, I am storing statistics for different affiliate and merchant sites, and I have a few questions about how to store it. My first idea was to create a serializable array and store it in a statistics column with the rest of the site information. I could even have two columns, one being an archive, and one being the current month. I know these arrays would get quite large, but they would only be retrieved when someone was looking at the statistics. Is this a viable way to do it? The other idea I had was to create tables for each site and ad and store the statistics as rows in each objects respective table. While easy, I didn't know if it was a bad idea to have a very large amount of tables, ie., one for every advertisement and site signed up for the affiliate program. Thanks for all your expertise in advance and I look forward to contributing to this great community. Dave
View 2 Replies
View Related
Jan 22, 2007
I have a table for articles that I want as
the basis for a blog. I have a field of description where the actual
article will go, I have only ever really
used tables to put in 'blocks' of text, how would I go about storing/displaying
data that is in my database table in a more formatted way, for example line
breaks, indents etc?
View 4 Replies
View Related