|
Well, since you already have a student record with an Id of 0, you can't add another one. ID's should not start with 0.
|
|
|
|
|
The scenario was:
1. I had designed tables with an inheritance relationship.
2. Decided that it was not a good idea
3. Removed an inheritance relationship
4. Added required IDs to the tables and set IsIdentity to true.
5. Forgot to set an identity property to "Identity".
Well...
Greetings - Jacek
|
|
|
|
|
Hi,
I am using the following code in my Form_Load to read the ConnectionString elements from my WinForm C# application.
sql_connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["SQLdb"].ConnectionString);
MySql.Data.MySqlClient.MySqlConnectionStringBuilder builder = new MySqlConnectionStringBuilder();
builder.ConnectionString = sql_connection.ConnectionString;
string server = builder.Server;
string port = builder.Port.ToString();
string user = builder.UserID;
string password = builder.Password;
string database = builder.Database;
string timeout = builder.ConnectionTimeout.ToString();
txtServer.Text = server;
txtPort.Text = port;
txtUserID.Text = user;
txtPassword.Text = password;
txtDatabase.Text = database;
txtTimeOut.Text = timeout;
I want to know how can get this back once changed by user and save it into the App.config's ConnectionString when user Clicks Save button?
Technology News @ www.JassimRahma.com
|
|
|
|
|
|
I have a working program that I want to add a little code to
Being a novice, ok beginner programer, I could use a little help.
Not sure the best way to do this, start another thread and cross thread, or can I do this in the one thread.
tnx
My thread code is like this
public static void Method_8()
{
while (method_state_6 && method_state_7 == true)
{
flooddrain.Write(false);
Thread.Sleep(1 * HourMs);
flooddrain.Write(true);
Thread.Sleep(1 * HourMs);
}
}
|
|
|
|
|
I don't see the need for another thread.
Change the logic here - maybe make your code more flexible by making HoursMS 24.
But unless there are other concerns you should not be going for another thread.
|
|
|
|
|
Well your right it should be done all in one thread.
some thing like this using a for loop a sleep and god knows what else Im really lost here.
for (int i = 0; i < 0; i++)
{
Thread.Sleep(1 * DayMs);
}
|
|
|
|
|
Ummm, do WHAT in another thread??
Also, your variable and method names suck. What in the Hell is "Method_8" supposed to do?? The name doesn't describe it's function at all. "Method_state_6"?? "Method_state_7"?? What do those represent??
Read up on the concept of "self documenting code".
|
|
|
|
|
ve3tru wrote: Then forget about threads, and certainly forget about using Thread.Sleep for long periods like this. Write your app such that it does all that is necessary in one go, and use the Windows scheduler to run it at the times you need.
Veni, vidi, abiit domum
|
|
|
|
|
Hello,i want a code which retrieve the color from an image.where image is in fix format and x-y co-ordinate also...i want a read pixel and find the color of that pixel not by mouse positioning by only co-ordinates.plzzzzzzzzz
|
|
|
|
|
What have you tried so far ? How many bits per pixel in the images: 1,4,8,16,24,32 ? Show us some code.
Google CEO, Erich Schmidt: "I keep asking for a product called Serendipity. This product would have access to everything ever written or recorded, know everything the user ever worked on and saved to his or her personal hard drive, and know a whole lot about the user's tastes, friends and predilections." 2004, USA Today interview
|
|
|
|
|
|
There are two ways depending if you need performance or not.
Use GetPixel (not performant) or LockBits and and seek the byte
(s) (can be calculated using Scan0 position plus y * stride + ( x * bits per pixel) assuming non indexed - for indexed this will give a reference in the pallet object which will hold the colour. Many examples of basic GDI+ lockbits scanning on the web.
|
|
|
|
|
I have 1 DateEdit display format dd/MM/yyyy, dd you want to enter the auto-focus past it always MM. What do you know with his help, thanks.
|
|
|
|
|
Try the DevExpress forum.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Hi All,
Is it possible to develop a visual studio add-in, which can be installable in any visual studio, I mean, that can be installable and usable in VS2005,VS2008,VS2010, VS2012 & 2013.
I have a visual studio add-in developed in VS2008, I wanted to make it generic such that, it will be installable and usable in any of the Visual studios. is it possible?
Thank you in advance for your help.
Regards
|
|
|
|
|
Guess that it's possible, since the supported hosts are specified in the XML. Keep in mind that every version has it's own deployment-location, so you'd still need to ask what version to install to.
There may be VS-versions where the addin-contract is altered; in that case, make a simple addin, and use that to load your functionality from a shared assembly.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Thank you Eddy for the relavent answer. Can you please extend your help in finding me an article/sample which can help me understanding your point "make a simple addin, and use that to load your functionality from a shared assembly".
Thank you,
|
|
|
|
|
There's a thread on SO[^] that talks about sharing stuff between projects.
You'd typically put the shared functionality in a project, and reference that (and invoke it) from your addin-project.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Richard/Team,
Accept my apologies, as I was not sure of the correct forum, i have posted 3 forums...thanks
|
|
|
|
|
What about the one called Visual Studio?
Veni, vidi, abiit domum
|
|
|
|
|
I am sorry, can you come again.
|
|
|
|
|
I am trying to start with serial port communication using C# for my project. So even though i am familiar with the C# language i am new into I/O Port communication and i seem to be having some problem with my code
using System;
using System.IO.Ports;
class Program
{
public static void Main ()
{
string portName = @"\\.\COM10";
_serialPort = new SerialPort (portName);
_serialPort.Close ();
}
}
i am getting an error :
Error 1 The name '_serialPort' does not exist in the current context c:\users\alfie\documents\visual studio 2012\Projects\serial\serial\Serial_port.cs
Someone pls help me get started with this. .
Also i have tested with the following code and verified that the COM10 port is working and is of type "char"
class Program
{
static void Main (string[] args)
{
string portName = @"\\.\COM10";
IntPtr handle = CreateFile (portName, 0, 0, IntPtr.Zero, 3, 0x80, IntPtr.Zero);
if(handle == (IntPtr) (-1))
{
Console.WriteLine ("Could not open " + portName + ": " + new Win32Exception ().Message);
Console.ReadKey ();
return;
}
FileType type = GetFileType (handle);
Console.WriteLine ("File " + portName + " reports its type as: " + type);
Console.ReadKey ();
}
[DllImport ("kernel32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall, SetLastError = true)]
public static extern IntPtr CreateFile (string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntPtr SecurityAttributes, uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile);
[DllImport ("kernel32.dll")]
static extern FileType GetFileType (IntPtr hFile);
enum FileType : uint
{
UNKNOWN = 0x0000,
DISK = 0x0001,
CHAR = 0x0002,
PIPE = 0x0003,
REMOTE = 0x8000,
}
}
|
|
|
|
|
The error message you are getting is telling us that you are using a variable called "_serialPort" but it is never defined. There needs to be a definition of that variable somewhere. Something like:
SerialPort _serialPort;
BDF
The internet makes dumb people dumber and clever people cleverer.
-- PaulowniaK
|
|
|
|