|
finally, i figer it out
i have to use a code similar to this
main idea is to write the type when we insert the image as "SqlDbType.Image"
SqlConnection con = new SqlConnection("DATA SOURCE = MAX_TOSHIBA;Initial Catalog=nodule; Integrated security = true");
string sql = "INSERT INTO pic (pic_id,patient,id,the_pic,pic_no) values ('" + j + "','" + txt_patient_name.Text + "','" + 0 + "', @a,'" + 0 + "')";
SqlCommand cmd = new SqlCommand();
SqlParameter sp = new SqlParameter("@a", SqlDbType.Image);
sp.Value = by_img;
cmd.Parameters.Add(sp);
cmd.CommandText = sql;
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
|
|
|
|
|
Hi,
I made a view from a few tables. I then imported that view into my Entity Data Model. The EDM assigned Entity Key = true to a column in the view that is not a primary key (the column is not a primary key in the view, and it is not a primary key in the table the view gets it from).
Why does the EDM do this? It assigned Entity Key = true to a value that IS an actual primary key (in the table my view looks at) and also to a value that ISN'T a primary key. I can't figure this out. Can anyone help me out?
TIA
PS -- I apologize if this is not the right forum, but since in the EDM I am dealing with C# code, I thought I'd post it here.
|
|
|
|
|
I can only think, this is not a fact, just my thoughts, that it is trying to create a form of compound key. All EntityTypes must have a key and so it is attempting to create a compund key that it thinks will be unique.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanks for your reply.
If this is the case, how would I get around it? If I set the column to NOT be a key, I get a mismatch error, suggesting that both fields (EDM and my DB) must be keys.
|
|
|
|
|
I very much regret that, I have no idea. I am only just starting out on the EF Highway, which is why I could still remember the stuff, in my previous post. Give it a month or two and I'll have forgotten that as well.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi,
Somehow I cannot load any WPF projects into VS 2008. The error I got is "The project type is not supported by this installation."
What is wrong with my VS 2008?
Best,
Jun
|
|
|
|
|
Which version of VS do you have?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
VS 2008 Version 9.0.30729.1 with .NET Framework 3.5 SP 1
Best,
Jun
|
|
|
|
|
Sorry, my fault. I meant version as in Standard, Express, Professional etc.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
|
OK.
Have you ever been able to load WPF projects? If so and you have recently installed any add-ons, I would try uninstalling them one by one and trying again between uninstalls.
Failing that, if your VS2008 has all the latest updates/service packs I can only suggest a Repair Install, I had a similar problem with an Express version a while ago, and that fixed it. Insert the install DVD and it should offer the Repair facility. If the option appears for a Custom Install, take that and make sure everything is checked.
That is all that I can offer.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Yes. This machine has been reinstalled by an IT person recently. The installation is not clean (half restore and half install).
I'll unstall/install VS 2008 first and see. Hopefully I don't have to redo the entire machine.
Thanks for the help.
Best,
Jun
|
|
|
|
|
Henry,
I have uninstalled all Visual Studio (6.0, 2003/2005/2008) and reinstalled VS 2008 Professional Edition only. The issue remains. After comparison, I do notice some strange things with this Edition:
1) I cannot create a new C# WPF project. The error is the same (project type not supported).
2) The New Project dialog shows the following different WPF types:
"csWPFApplication" (should be "WPF Application")
"csWPFBrowserApplication" (should be "WPF Browser Application"
"csWPFControlLibrary" (should be "WPF Control Library")
"csWPFCustomControl" (should be "WPF Custom Control")
3) All non-WPF types are fine.
By the way, this VS 2008 Edition was from a MSDN subscription.
------------------------
FYI, after I installed VS 2008 SP1 this Edition works like a charm. No WPF project type issue any more. Thanks!
Best,
Jun
|
|
|
|
|
This is very strange. I am at a loss.
Can I suggest that you ask this (exactly as here) in the Microsoft forums here[^].
If you do find a solution, please let us know as it could be useful to others.
I am sorry not to be able to help more. Good Luck.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi, have a good day ,
I was wondering , how do you write Database Application With C# ?
I mean what is the your way , what tools do you use and what is your rules ?
--- For me :
1 - All My SqlConnection , DataTable Are in Runtime ( no desing at all )
2 - I write INSERT and update and delete Sql Query Manually , like functions ( even if I have 50 values in INSERT command I wrote them
as paramters
public static void DeletePerson ( string guid )
{
SqlCommand SqlCmd.CommandText ="DELETE FROM persons WHERE guid = @guid";
SqlCmd.Parameters.AddWithValue ("@guid" , guid);
SqlCmd.ExecuteNonQuery();
SqlCmd.Parameters.Clear();
}
3 - I always use paramters .
4 - I always use Transaction ( even for the short one )
5 - I never ever Use Binding Source ( I build one manually )
Like
TxtPerson.Text = clsDataTable.Rows[CurrentRecored]["Name"].ToString();
Insted of
TxtPerson.DataBindings.Add("Text" , bindingsource , "name" );
6 - I never use Identity in my database , I generte the last number
manually
SELECT MAX(PersonID) FROM persons
7 - All my tables recored dependes on GUID ( No Guid = No table at all )
8 - I use SQL Query Analyzer ... I hate VS Server Explorer ...
9 - For Complex Search Query
I used some routin's like :
public string[] SearchUserNames = { "Name" , "Age" };
public string[] SearchDBNames = { "pName" , "pAge"};
stQuery = "SELECT * FROM persons";
int isAnd = 0;
if (CheckName.Checked)
{
stQuery += " WHERE " + SearchDBNames[combobox.SelectedIndex].ToString();
isAnd++;
}
if (CheckAge.Checked)
{
if (isAnd != 0)
{
stQuery += " AND ";
}
else
{
stQuery += " WHERE ";
}
stQuery += SearchDBNames[combobox.SelectedIndex].ToString();
isAnd++;
}
I want to hear from you ... what is yours ?
I am doing right ?
Thank you , for time and for your advice ...
I know nothing , I know nothing ...
|
|
|
|
|
I do a lot of what you have said.
Isn't Max(PersonId) going to be very inefficient?
I have never had the need to do number 9. It looks too complicated IMHO, although I can see why you do it.
I always use using when I'm using databases though. eg.
using (SqlCommand command = new SqlCommand(sql, connection))
{
}
|
|
|
|
|
Have a look at the DatabaseAccessor[^] article.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
Hi! I would like know how can I upload and delete video files saved in server using an aplication from client with webservices.
I was reading that I can use the class HttpFileCollection, class Uploader: IHttpHandler with the method ProcessRequest( HttpContext context ) or ftp.
What do you think? Any suggestion?
Thanks a lot.
|
|
|
|
|
You can write any method you like in a webservice to send or deliver a stream of bytes. you may need to chunk large files tho.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
I would like to try attachments to be sent to WebServices.
You can find the details here[^] or google.
|
|
|
|
|
Thanks for the suggestions.
I used ftp. And no problem.
|
|
|
|
|
How to add scroll Horigental scroll bar in the call of DataGridView
Now each X seconds, the datagrid is updated with data from the database. So the datagridview is refreshed.
I also want to maintains the position of scroll bar even after datagridview is refreshed.
When a user is working on row X, and column Y, and the datagrid is refreshed all the scrollbars get back at position 0. So the horizontal scrollbar is put back to the left side of the screen, and the vertical scrollbar is put back on the top of the screen.
Raghvendra
|
|
|
|
|
int _xScrollPosition = dataGridView1.HorizontalScrollingOffset;
dataGridView1.HorizontalScrollingOffset = _xScrollPosition;
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Hello,
I'having problems getting the "Taborder" right on a ToolBar which has a UserControl hosted in a ToolStripControlhost object.
To replicate:
1. Create a new WindowsForms project.
2 Add a toolBar with four ToolBarButtons to Form1 (via the designer)
3. Create a new UserControl and drop a MaskedTextBox on it (via the designer)
5. In the form Constructor add the following code;
toolStrip1.Items.Insert(2, new ToolStripControlHost(new UserControl1()));
During runtime if you click on the maskedTextBox in the toolStrip (to give it focus), and try to navigate with the tab key (either shifttab or tab) you'll notice a weird taborder.
If the MaskedTextbox is hosted directly in the ToolStripHostControl everything works fine. But my real usercontrol is way too comlicated to do this.
The problem seems to be caused by inserting a usercontrol in a toolstrip which messes up the taborder.
Does anyone know how to fix this? Any help would be sincerely appreciated.
|
|
|
|
|
The only thing I can think of is after adding UserControl1 go through first the toolstrip then usercontrol1 controls collection and manually set the tab order to what you want.
Other than that I've no idea. Perhaps someone else can help.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|