|
the problem was that all processes was inherting sockets handle
Anyhow i thought i might post the solution if any1 else have same problem, simply use SetHandleInformation [^]thru pinvoke!
|
|
|
|
|
am working on a micro-finance accounting system, and i have decided to use MySQL as the database. I have installed MySql 4.01, and have everything including the Server, Admin, and connector installed and running fine.
Am currently trying to test a means of loading data into a datagridview from one of the tables in the MySql db. But app fails when i try to open a connection to the db:
MySqlConnection con = new MySqlConnection("server=localhost;database=pets;uid=root;password=alchemy@6");
con.Open(); //creates error "Access denied for user 'root'@'localhost' (using password: YES)"
can someone help me?
|
|
|
|
|
looks like your username and/or password is wrong do you not think?
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
I don't think, because i have just used those very parameters to log into the database via the MySql Adminstrator (GUI), and can clearly see the database.
could it be a result of having a session running with those very details in the Adminstrator?
|
|
|
|
|
I am not so familiar with MySQL but if there is a setting that specifies the number of logins available (like in SQL Server) then I would say that could be a cause yes. One thing to note about database connection is that the error message you get is not always correct
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Well, after rummaging through the MySQL .NET API Documentation and failing to find a clue, i decided to change the connection string to a different one like this:
my Original : "server=localhost;database=db;uid=root;password=abcdaaa"
in the API : "Database=db;DataSource=localhost;UserId=root;Password=abcdaaa;";
New Hack: "Database=db;DataSource=localhost;UserId=root;Password=abcdaaa;Port=3308";
/*This worked bcoz i realised i had configured MySql to listen on port 3308, tried changing it back to 3306 (default) with no success, until i decided to add the 'Port=3308' to the MySQL connection string.*/
|
|
|
|
|
The problem is:
By using late binding call the TransferSpreadSheet metod with arguments (acExport, default, "querryname", "querryname.xls",default,default)
The question is:
How can i get acExport constant of AcDataTransferType an how should i transfer it to TransferSpreadSheet call method?
Parameters = new Object[5];
Parameters[0] = ???!
Parameters[1] = Type.Missing;
Parameters[2] = "querryname";
Parameters[3] = AppPath + "\\querryname.xls";
objDoCmd_Late.GetType().InvokeMember("TransferSpreadsheet", BindingFlags.InvokeMethod,
null, objDoCmd_Late,Parameters);
Advice needed.
modified on Tuesday, August 4, 2009 8:43 AM
|
|
|
|
|
I just want to know if its possible to include the double quotation marks ("") as one of regex delimiters?
If it is possible, how will i be able to include it? Because whenever i include one, it always terminates the pattern string.
Then if it's not possible, is/are there any alternatives ways so i can make the double quotes as delimiters?
|
|
|
|
|
I'm so bad with RegEx, everytime I want to use them I need that[^]!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
That link that you gave me may help me alot since i don't know how to create a regex pattern for matching strings...ehehehe..
|
|
|
|
|
It works fine for me - are you sure you aren't mistaking " as a string terminator for it terminating the regex?
string s = "hello \"x\"there\"x\" it \"works\"";
Regex r = new Regex("\"x\"");
string y = r.Replace(s, "!");
gives y = hello !there! it "works"
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Hi All,
i want to edit DataSet value before binding to GridView. How can i do that..?
conn.open();
string result="select name,address,age";
sqlCommand cmnd=new sqlCommand(result);
sqlDataAdapter ad=new sqlDataAdapter(result,conn);
DataSet ds=new DataSet();
result.Connection=conn;
ad.SelectCommand=result;
// in here i want to edit (divide age value by 2) before bind data to gridview.
ad.fill(ds);
GridView1.DataSource=ds;
GridView1.DataBind();
conn.close();
i want to divide age value by 2 before bind data to gridview.How can i do that...???
Thank you very much .....
CheeN
|
|
|
|
|
would it be ok to do it with you sql statement.
In that case you could do:
Select name, adress, age / 2 as age
from [yourdbname]
|
|
|
|
|
Thank you for you reply .....But i had a problem when i going to DataBind.
this is the error..
GridView1.DataBind(); //------ error - A field or property with the name 'age' was not found on the selected data.
But i correctly configured on GridView1.I use a BoundField to view this 'age' with DataField='age'on my GridView1 control..
Why i got this error..????
CheeN
|
|
|
|
|
hey i fixed that prob...thank you bude rly thank......
CheeN
|
|
|
|
|
My pleasure. Glad i could help
|
|
|
|
|
You can create new coloum that age value is divied by 2, and delete the old age column and set the new column's name to "age"
|
|
|
|
|
Thank you friend..i fixed that problem.using follwing codes
string result="select name,address,age/2 as nAge";
On my GridView1 I set my DataField ='nAgew'
Then its all right...
Thank you all of you to Guide me to fixed that problem....
CheeN
|
|
|
|
|
You can change it very easily
suppose you have the dataset ds
Then
ds.Tables[0].rows[2].columns[2]="Your New Value";
Thank you
Vinod Kumar Prajapati
Software Engineer
EBC Publishing Pvt. Ltd.
|
|
|
|
|
Hello,
I have a bound DataGridView with one of the columns bound to a date field. If date is entered as 31-08-2009 everything works fine, but user wants to fill in the date as 31082009 (European format).
On the cell leave event I have:
if (this.dgvInvoice.Columns[e.ColumnIndex].Name == "DateColumn")
{
string DateText = this.dgvInvoice.Rows[e.RowIndex].Cells["DateColumn"].EditedFormattedValue.ToString();
try
{
this.dgvInvoice.Rows[e.RowIndex].Cells["DateColumn"].Value =
customfunction(DateText);
}
catch
{
this.dgvInvoice.Rows[e.RowIndex].Cells["DateColumn"].Value = DateTime.Today;
}
}
}
The customfunction returns a date like 31-08-2009. The try goes well, but still I have an exception that it's not a valid DateTime.
The EditedFormattedValue is not writeable, and after I set the Value, the EditedFormattedValue is still the same.
How can I solve this ?
Thanks in advance.
Rob
|
|
|
|
|
Hi Rob!
It seems you use CellLeave event of the grid and alter leaving the event logic the value not always updates correctly.This event is fired when cell lose its focus,not when it was edited by the user.You would better use CellEndEdit event.
|
|
|
|
|
Alas, the exception about a bad date is thrown before the endedit event is raised.
Any other suggestions ?
Thanks,
Rob
|
|
|
|
|
What kind of DataSource are you using for your grid?
Is it DataTable or someone else?
|
|
|
|
|
It's a datatable. The specific column is a date field in the datatable.
Rob
|
|
|
|
|
I think this have to solve your problem :
private void Grid_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
{
if (this.dgvInvoice.Columns[e.ColumnIndex].Name == "DateColumn")
{
try
{
e.Value=customfunction(e.Value);
}
catch
{
e.Value = DateTime.Today;
}
}
e.ParsingApplied = true;
}
Cheers!
|
|
|
|