|
BioSecureDataSet.EmployeeRow employeerow = ??;
BioSecureDataSet.LoginRow loginrow = ??;
this.bioSecureDataSet.Login.Rows.Remove(loginrow);
this.loginTableAdapter.Update(this.bioSecureDataSet.Login);
this.bioSecureDataSet.Employee.Rows.Remove(employeerow);
this.employeeTableAdapter.Update(this.bioSecureDataSet.Employee);
I'm sure i have to define the loginrow and employeerow.
but i don't know what to define them as? I just want it to be the current information(data row) that it is showing..
|
|
|
|
|
Let's pretend Login has a string property "Id" as the primary key. Your code will might look like
BioSecureDataSet.EmployeeRow FindEmployeeRow(string id)
{
return this.bioSecureDataSet.Login.Rows.Find(id);
}
void YourMethod(string loginId, )
{
BioSecureDataSet.EmployeeRow employeerow = FindEmployeeRow(loginId);
}
Note that the exact implementation depends upon the primary key on your data set!
|
|
|
|
|
Remove method of DataRowCollection removes the data from DataTable not from the database.
To remove to row both from DataSet and your DB using DBDataAdapters you should call DataRow.Delete() into your case:
<br />
loginrow.Delete();<br />
this.loginTableAdapter.Update(this.bioSecureDataSet.Login);<br />
Life is a stage and we are all actors!
|
|
|
|
|
hmmm. i got the error "Object reference not set to an instance of an object."
|
|
|
|
|
And where exactly it occurred?
Life is a stage and we are all actors!
|
|
|
|
|
loginrow.Delete();
It say Null Reference Exception was Unhandled.
|
|
|
|
|
That means that loginrow is null instance.How you get it from? Do you have DbCommandBuilder linked with your DbDataAdapter?Do you have any primary/unique keys defined into the underlying table?
Life is a stage and we are all actors!
|
|
|
|
|
BioSecureDataSet.LoginRow loginrow; ?
yes, i have DbCommandBuilder linked with my DbDataAdapter. and yes i have a primary keys defined (if you must know it's employeeID).
omg, i'm bad at this.
|
|
|
|
|
You need to set the login row to something. To work, it needs to be a row in your dataset,
did you try the find method I posted earlier
e.g.
BioSecureDataSet.LoginRow loginrow;
becomes
BioSecureDataSet.LoginRow loginrow = FindEmployeeRow(employeeId)
Where the FindEmployeeRow(employeeId) calls the method I posted earlier.
Assuming you don't know which row index you are working with!
|
|
|
|
|
I hope now he/she has solved the problem.
Life is a stage and we are all actors!
|
|
|
|
|
Me Too!
|
|
|
|
|
do i really need to use the find method?
because i am able to go through the information(of staff) row by row; which is by dragging the datasource out.
i just need to delete the row which is currently shown.
|
|
|
|
|
hi all,
is it possible to convert an aspx page to PDF file?
for example, i have default.aspx page in that user will key in some info.
at the end if he clicks on convert to pdf button, the whole page should have to convert to PDF and
have to store somewhere
|
|
|
|
|
anithasalavadi wrote: is it possible to convert an aspx page to PDF file?
Yes, you can put it's output in a PDF. Easiest solution would be to print to PDF[^]
|
|
|
|
|
|
1. What is the problem ? Just create in array in "User" class and give get/set property to it. Then you can use it also from Main.
2. Get a random number, add it in an array. Next time if you get random number, compare it to that array, if number exists, then get new one.
|
|
|
|
|
Ok..after that how will make the random class generate numbers maximum of 6 numbers?
ex. 10, 36, 12, 1, 38, 21
|
|
|
|
|
I just give you a hint :
I will not do the homework for you.
See No. 2 how to avoid creating double random number.
To create 6 random number, just use :
Random random = new Random();
int myNumber = random.Next();
Just call random.Next() 6 times.
|
|
|
|
|
How to add a toolbar using windows forms programming of c#
|
|
|
|
|
|
I just created a brand new site, it's called Google. It's neat, give it a try!
Google: C# toolbar[^]
|
|
|
|
|
If i want to run code at runtime from string (Something simple)
How can i do it?
for example , i want something that does "operateThisString" function :
public int X
{
get { return this.Y * this.Z; }
}
public int Y
{
get { return (int)((Math.Sin(new Random() * 10))*52); }
}
private void button1_Click(object sender, EventArgs e)
{
string codeExpressionThatReturnInt = "return (this.X*this.Y%2);";
int numbber = operateThisString(codeExpressionThatReturnInt);
if (number == 0)
MessageBox.Show("This number is Even.");
else if(number==1)
MessageBox.Show("This number is Odd.");
}
the string codeExpression can come from the user in some way.
What is the simplest way to do it?
|
|
|
|
|
|
bonzaiholding wrote: What is the simplest way to do it?
The MSScriptControl - that would allow you to run JavaScript/VBScript dynamically. The good news is that there are lots of articles on this subject.
The bad news is that it's "old", and you'd prolly want to offer the user VB.NET or C# to extend the application. That means offering an editor, embedding the compiler, and loading the generated assembly during runtime.
This[^] article would get you started on the first technique, this[^] article if you go for the second option.
|
|
|
|
|
Can you please give me an exmaple how to do it?
|
|
|
|