Hi, there is no enum datatype in MS SQL. You may use a check constraint. Something like that: CREATE TABLE tblTest ( ID INT PRIMARY KEY IDENTITY, ANormalColumn VARCHAR(10) DEFAULT ('') NOT NULL, RestrictedColumn INT CHECK (RestrictedColumn IN (1,2,3) )
The first of the following inserts is OK, while the latter throws an error: INSERT INTO tblTest (ANormalColumn, RestrictedColumn) VALUES ('A', 1) INSERT INTO tblTest (ANormalColumn, RestrictedColumn) VALUES ('B', 4)
-sa
Sascha Andres
Posts
-
SQL Server enum datatype problem -
geting image from httpHi, basically getting data via Http contains two things: 1. the request 2. the response The strean object of the Request object (HttpWebRequest) in your case is to send data to the web. Getting the answer is to get the response and reading it's stream. So use something like this:
HttpWebRequest hwr = HttpWebRequest.Create("http://www.onet.pl/_m/32006b80b5eb4c237bb11e1a25895e83.jpg") as HttpWebRequest; HttpWebResponse resp = (HttpWebResponse) hwr.GetResponse(); pictureBox1.Image = Image.FromStream(resp.GetResponseStream()); resp.Close(); resp = null; hwr = null;
Don't forget to close the repsonse! If not, you might run into exceptions after getting data from the web multiple times. -sa -
Getting the exe pathHi, since now I used sonething like this:
System.IO.FileInfo fi = new System.IO.FileInfo(Application.ExecutablePath);
GlobalContainer.ExecutablePath = fi.DirectoryName;
fi = null;Help states: Property Value The path and executable name for the executable file that started the application. Caveeat: You need to reference System.Windows.Forms. -sa -- http://www.livingit.de http://www.mobile-bookmarks.info http://www.not2long.net
-
Socket Programming - How Do I Send and Receive a Class or StructureHi, have you read my edit of the post? I wrote I have just overseen the "without serialization", and just after I clicked 'Submit' I read this two words. Using the marshalling way is possible the best way for his problem. Bye, Sascha -- http://www.livingit.de http://www.mobile-bookmarks.info http://www.not2long.net
-
Socket Programming - How Do I Send and Receive a Class or StructureI think you can do this in more than one way. Any way has it's pros and cons. One way would be using MS Messaging Queue to transport your object. Besides beeing a simple way without too much pain on thinking how to transmit it on the networking part, this requires to have the MSMQ services running. An other way is remoting. I haven't done much with remoting yet, so perhaps I may be wrong here. An other way would be to serialize the object (you can choose between XML or binary for example) and send the serialized object via TCP/IP and deserialize on the other machine. This includes a bit more work (serializing) and has the lower level transport. If the last part is already done, this might be a fast switch. [Sorry: I've overseen "without serialization", so forget the last possibility.] HTH, Sascha -- http://www.livingit.de http://www.mobile-bookmarks.info http://www.not2long.net
-
datagrid update failureHi Randy, dorianr wrote: This doesn't make any sense to me, since the DESCRIPTION field is not a Primary Key, and the updates are successful within Access. I have used the generated Update code, and I have written my own update code - I get the same error message. This sounds really a bit strange - just as the line would first be deleted, and later inserted again :confused: I think PERMISSION_TYPES is just a lookup table. Something that helps the user of your program to sort the records in the user table. Personally I prefer not to have the user edit a lookup table side by side of the main table. I do this because:
- the permission type is linked to more than one line, editing with only one row is usually specific, and lookups should be general
- On a multi user system not all users should have adminstrator priviledges, eg access to the options. Defining possible permissiontypes (or more general: options)is the admins task
OK, this does not really solve your problem with the table, but perhaps an other way of doing things might be helpful. Sascha -- http://www.livingit.de http://www.mobile-bookmarks.info
-
Where r the Shape and Line Controls???dshay1 wrote: Does any one know what happened to them? AFAIK they disappeared by design. That is that you must paint your own line with GDI+. I don't think this is a great shift back. One may think about creating a control that behaves similar to the VB6 controls. Besides they were easy to use, they had one big caveat: They were full blown objects, with all the memory consumption. Try searching codeproject.com for examples on GDI+. You will find how to draw a line - and four lines make a shape ;) Sascha -- http://www.livingit.de http://www.mobile-bookmarks.info