|
Thanks for your response,
i want to know if it better to connect all application users to same database user or there is will be a database user for each application user
|
|
|
|
|
It's better to have only one database user, because then you can pool connections, and they can be shared by all users.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I'm working in VS2003 and I've used the Sql DataAdapter Wizard to create a data connection, sql data adapter, stored procedures, and dataset in a winform. I can search and update okay but I get an error when I try to add a new record using the AddNew() Method against the dataset. Any help appreciated.
static void Main()
{
Application.Run(new Form1());
}
private void btnSearch_Click(object sender, System.EventArgs e)
{
sqlDataAdapter1.SelectCommand.Parameters["@Param2"].Value = txtBoxSPSearch.Text;
dsStaffPhysicians1.Clear();
sqlDataAdapter1.Fill(dsStaffPhysicians1);
}
private void btnReset_Click(object sender, System.EventArgs e)
{
this.dsStaffPhysicians1.Clear();
ClearStaffPhysician();
}
private void SetupStaffPhysician()
{ //Initialize Staff Physician Page
panel1.Visible = true;
this.cBoxSPLicenseState.DataBindings.Add(new System.Windows.Forms.Binding("SelectedIndex", this.dsStaffPhysicians1, "tblStaffPhysicians.docLicenseState"));
}
private void ClearStaffPhysician()
{ //Clears textboxes and dropdowns
txtBoxSPFirstName.Text = "";
txtBoxSPMiddleName.Text = "";
txtBoxSPLastName.Text = "";
txtBoxSPUpin.Text = "";
txtBoxSPLicenseNumber.Text = "";
txtBoxSPSearch.Text = "";
cBoxSPLicenseState.SelectedIndex = 0;
}
private void menuItem2_Click(object sender, System.EventArgs e)
{ //Main menu -- Staff Physicians
SetupStaffPhysician();
menuItem2.Enabled = false;
}
private void btnUpdate_Click(object sender, System.EventArgs e)
{
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].EndCurrentEdit();
sqlDataAdapter1.Update(dsStaffPhysicians1);
sqlDataAdapter1.Fill(dsStaffPhysicians1);
}
private void btnInsert_Click(object sender, System.EventArgs e)
{
//Generates Error:System.Data.NoNullAllowedException
//Column 'docLName' does not allow nulls.
this.BindingContext[dsStaffPhysicians1, "tblStaffPhysicians"].AddNew();
}
private void menuItem3_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
private void btnCommit_Click(object sender, System.EventArgs e)
{
//will need to do something here to commit insert
}
}
}
|
|
|
|
|
The problem is in the underlying schema for the database. You either need to change the properties of the field 'docLName' to allow null values, or provide a value in the addnew()
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Thanks for responding; I'd rather not change the schema if possible. Can you tell me how to 'provide a value in the addnew()'? I've been all over the MSDN and don't have a clue how to proceed. Any help greatly appreciated.
|
|
|
|
|
hi, i have a datagrid with a size = 280; 216 and a PreferredColumnWidth = 120
i have 2 columns!
if i write some text in row nr 7 you can see a vertical scrollbar on the left side!
so i must set a smaller PreferredColumnWidth:
<br />
private void dataGrid1_CurrentCellChanged(object sender, System.EventArgs e)<br />
{<br />
if(dataGrid1.CurrentRowIndex == 7) && some text ist entered....!?<br />
{<br />
dataGrid1.PreferredColumnWidth = 20;<br />
}<br />
}<br />
but nothing change;-(
cu
|
|
|
|
|
Could you tell me what books like Real World .NET Application ?
The book has some good application for learning.
Thanks in advance
|
|
|
|
|
I searched in Google for that book to see what you were talking about, and I couldn't find it.
However, I don't think a book can help you learn much. Sure, you'll learn the basics (I myself have many books from which I've learned the basics for many technologies), but for more advanced knowledge, you have to sit down, roll up your sleeves and do it.
If you want to really learn, I'd say that you set your self a difficult goal (writing a more or less big application, that uses different things -- a smart client app and a web app, both working on a remote database for example). Trying to accomplish something, as opposed to reading about it, will really make you learn.
If you want to learn about the architecture side of an application, MSDN[^] has several good articles and advanced sample applications.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
Hi All,
I've try to send a Microsoft Access Database file through the network, sending the file works fine with the same length of the original. The problem is when I try to open the file at the client side a message appears (“unrecognized database format ").
Any help please, Thanks
Kind Regards,
Mohammad
|
|
|
|
|
How do you send the file?
---
b { font-weight: normal; }
|
|
|
|
|
// Server Side.
FileInfo file = new FileInfo("Inventory.mdb");
// Send the file lenght to the client.
this.client.Send(Encoding.ASCII.GetBytes(""+file.Length));
// Send only database.
FileStream MyFile = new FileStream("Inventory.mdb", System.IO.FileMode.Open);
byte [] output = new byte[file.Length];
// Reading the file.
MyFile.Read(output, 0, (int)file.Length);
MyFile.Flush();
// Send the file to the client.
this.client.Send(output);
MyFile.Close();
---------------------------------------------------------------------------------------
// Client Side.
// Recieve the file length
input = new byte[1000];
int length = this.server.Receive(input);
length = int.Parse(Encoding.ASCII.GetString(input,0,input.Length));
// Receive the file.
input = new byte[length];
length = this.server.Receive(input);
// Create the Backup file.
FileStream myDataBase = new FileStream("CopyofInventory.mdb",System.IO.FileMode.Create);
myDataBase.Write(input,0,input.Length);
myDataBase.Close();
Thanks,
Mohammad
|
|
|
|
|
From what I can tell from the code, you read 1000 bytes into the array input, then parse the length from he beginning of that. If the length occupies the first 6 bytes of the stream, you will be discarding the first 994 bytes of the actual database file.
---
b { font-weight: normal; }
|
|
|
|
|
I want to use VC++ *.lib into C# application. I know that I must compile the lib in to a dll. How can i do that? Any method and hits to me.
|
|
|
|
|
One way is to create a new .NET project called Class Library and copy over your VC++ code. Sometimes the "It Just Works" effect will be able to translate the code. Then when you compile it, you will have your dll which you can make other projects reference. The easier way would be to open the .lib project in VC++ 6.0 and go into Project->Settings and change the output from a static library (.lib) to a dynamic library (.dll). Compile it in VC++ 6.0 to get your .dll file, which your .NET project will be able to reference.
|
|
|
|
|
As the other reply says, I would link your static library (.LIB) into a regular DLL using Visual C++ 6.0. Then I would use P/Invoke to call into the unmanaged DLL from .NET.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
The amount of sleep the average person needs is five more minutes. -- Vikram A Punathambekar, Aug. 11, 2005
|
|
|
|
|
I'm trying to serialize a tree-like structure, and I get a System.InvalidOperationException: "When serializing an object of type RTBranch, a circular reference was found".
I've trached this to a public property which I don't want to be serialzed anyway, but the compiler says I can't apply the [NonSerializable] attribute to this. Removing the property fixes the problem (but obviously that's not what I want )
So far, the data only has a single branch (the root), but RTBranch has a public property AllBranches { get }which (recursively) returns all branches (i.e. this and all child branches, child child branches) in an ArrayList.
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
You can use the [XMLIgnore] (MSDN[^]) attribute on the offending property to stop it being serialized
"I think I speak on behalf of everyone here when I say huh?" - Buffy
-- modified at 3:36 Sunday 4th September, 2005
|
|
|
|
|
Thanks!
Would that work for non-XML serialization too?
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
No, I believe XMLIgnore attribute works only for XML serialization. I belive NonSerialized attribute is meant for binary serialization.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
|
|
|
|
|
Hm... a little inconsistency.
Is is actually possible to tag only the attributes / properties I want to serialize?
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
Actually, I may have misled you in my previous post. The Serializable and NonSerializable attributes apply to wide-scale serialization: for example, if you wanted to use .NET remoting to send an object over to another process or another machine, these attributes would apply.
The XmlIgnore and XmlInclude attributes really apply only to the specialized case of XML serialization.
However, I use Xml serialization so rarely, you might be better off getting an answer from someone more experienced with it. At work, we almost exclusively do binary serialization, as it's quite a bit faster. The only xml serializing we do is with application config files, and even then, there's built-in support in the framework for configuration files.
peterchen wrote:
Is is actually possible to tag only the attributes / properties I want to serialize?
Sure. Mark your class as Serializable, then have it implement ISerializable. This will allow you to control precisely what data is saved and what is ignored.
*edit* Or, optionally, just mark your class as Serializable, then mark each field you don't want serialized as NonSerializable.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Cops & Robbers
Judah Himango
-- modified at 21:02 Sunday 4th September, 2005
|
|
|
|
|
When I execture my app "normally", I get a complete exception description. However, when I run it under the debugger, I only get a general text in the "Output" Window.
Any way to have full exception reporting in debug mode?
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
(1) How to make a button the default one?
(2) How to rearrange the control order (except juggling the TabOrder property on each control individually, trying not to hit one that was already used)
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
-- modified at 3:00 Sunday 4th September, 2005
|
|
|
|
|
How to make a button the default one?
Use the Form's AcceptButton property (under Misc)
How to rearrange the control order
I'd like to know too - I only ever found it once and that was by accident
"I think I speak on behalf of everyone here when I say huh?" - Buffy
|
|
|
|
|