|
I want to create a table "Employee" with columns:empname,age and empcode(which takes two letters from employee name and append number to it.,e.g.:-ga1,om2 where ga stands for ganesh,om stands for omkar)
please help me with the following
|
|
|
|
|
It's already in the C# forum; please don't cross-post.
FWIW, sounds like a calculated field to me.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Where are you stuck?
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Take the first two characters of one name and concatenate to the other.
|
|
|
|
|
Hello, my 2nd post here, so I'm a bit of a nOOb.
AFAIK the convention for using Radio Buttons is to have 1 selected by default.
Q: Is it reasonable or acceptable to break this convention for the purpose of forcing the user to make a deliberate selection in a customised application?
B/ground: I made the buttons myself using Small Basic and they are for a Pizza order form. One group has 2 sets of buttons, 1 set [small, medium, large], 2nd set [thin, thick]. The user can only continue once selection is made.
Currently I'm thinking why not by considering that a convention is a wise and preferred norm as opposed to a rule which may not allow such discretion. Also I read that some API's allow the use of RB's without having 1 selected by default.
|
|
|
|
|
Sure, I don't see why that wouldn't be acceptable. It is a practice used many places. As an example, on the CodeProject main page, there is a new survey every week and when it is the type that requires a radio button input, none of the options are initially selected.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
Thanks Soren for your helpful reply.
Wow I just realised it is xmas on the other side of the planet. Happy xmas.
Yeah I think conventions are contextual. 'When in CodeProjectLand do as CodeProjectarians do'.
|
|
|
|
|
Jibba Jabba wrote: Yeah I think conventions are contextual. 'When in CodeProjectLand do as CodeProjectarians do'. I wouldn't say that, I see that behavior all the time, referring to the CP survey just seemed like an obvious thing to do.
Jibba Jabba wrote: Wow I just realised it is xmas on the other side of the planet. Happy xmas. Merry Christmas to you too.
Soren Madsen
"When you don't know what you're doing it's best to do it quickly" - Jase #DuckDynasty
|
|
|
|
|
"I wouldn't say that, I see that behavior all the time, referring to the CP survey just seemed like an obvious thing to do."
Thanks, helpful reply. And I agree.
In my solution to the exercise, not only was it obvious, I stated (on the other forum) that the hypothetical pizza shop owner wanted it. Happy user? That's gotta be good.
Appreciate your experience and thoughts.
|
|
|
|
|
I see it both ways many times. It all depends on what your needs are. If you want to force a selection then don't have one selected by default.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Thanks for your replies.
I just found the vote helpful button. Was a bit slow, nOOb issues.
|
|
|
|
|
You're welcome.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Just adding some more thoughts on this.
If an api required a default selection based on this said convention, and you chose not to make your own buttons, then applying this to the pizza example, I'd have to have a default "no selection" choice, which is redundant and I think absurd. And then force an alternative selection.
Unusual convention I think. Once again thanks for your thoughts on this.
|
|
|
|
|
How to start working with asp.net web application
|
|
|
|
|
Get a book and start working through the examples. The do some online tutorials, then define the project you want to do and find some examples and tutorials on or close to the subject.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
In addition to Mycroft's suggestion, you could also go to http://www.asp.net/[^]. Also note that there is a specific forum for ASP.NET questions.
Veni, vidi, abiit domum
|
|
|
|
|
Hello. I did the following:
Update-delete-insert-save in the dataset.
not in the database.
And now i want my dataset to affect the database(sql server)
without using DataAdapter.(It's a method for lazy people)
How can i do that?
Any help is appreciated.
Thank you
|
|
|
|
|
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ComboBox1.SelectedIndexChanged
Try
Dim dv As DataView = New DataView(_DataSet.Tables(0))
If ComboBox1.Text = "Deleted" Then
dv.RowStateFilter = DataViewRowState.Deleted
Me.DataGridView2.DataSource = dv
Me.DataGridView2.Refresh()
ElseIf ComboBox1.Text = "Added" Then
dv.RowStateFilter = DataViewRowState.Added
Me.DataGridView2.DataSource = dv
Me.DataGridView2.Refresh()
ElseIf ComboBox1.Text = "Unchanged" Then
dv.RowStateFilter = DataViewRowState.Unchanged
Me.DataGridView2.DataSource = dv
Me.DataGridView2.Refresh()
ElseIf ComboBox1.Text = "None" Then
dv.RowStateFilter = DataViewRowState.None
Me.DataGridView2.DataSource = dv
Me.DataGridView2.Refresh()
ElseIf ComboBox1.Text = "Current Rows" Then
dv.RowStateFilter = DataViewRowState.CurrentRows
Me.DataGridView2.DataSource = dv
Me.DataGridView2.Refresh()
ElseIf ComboBox1.Text = "OriginalRows" Then
dv.RowStateFilter = DataViewRowState.OriginalRows
Me.DataGridView2.DataSource = dv
Me.DataGridView2.Refresh()
ElseIf ComboBox1.Text = "Modified Current" Then
dv.RowStateFilter = DataViewRowState.ModifiedCurrent
Me.DataGridView2.DataSource = dv
Me.DataGridView2.Refresh()
ElseIf ComboBox1.Text = "Modified Original" Then
dv.RowStateFilter = DataViewRowState.ModifiedOriginal
Me.DataGridView2.DataSource = dv
Me.DataGridView2.Refresh()
ElseIf ComboBox1.Text = "Modified Current" Then
dv.RowStateFilter = DataViewRowState.ModifiedCurrent
Me.DataGridView2.DataSource = dv
Me.DataGridView2.Refresh()
End If
Catch ex As Exception
MsgBox("No record were Modified")
End Try
End Sub
modified 20-Dec-13 4:37am.
|
|
|
|
|
Ugly, ugly, ugly code. Did you try it?? Did it update the database?? Probably not.
|
|
|
|
|
I updated it . Can you check it Please?
|
|
|
|
|
Nothing changed. It's still very ugly and has no code at all for updating the database.
If you want to manually rewrite the code that you find in the DataAdapter, that's your choice. I don't see why you're not using a DataAdapter, but then again, I don't what you're SELECT query looks like either.
The Refresh method only redraws the grid on screen. It does NOT tell anything to touch the database.
|
|
|
|
|
Clean up your code.
Use ElseIf .
|
|
|
|
|
Member 10388494 wrote: And now i want my dataset to affect the database(sql server) without using DataAdapter.(It's a method for lazy people) Only if you consider .NET to be a language for those who are to lazy to write assembler
There's nothing wrong with using a DataAdapter
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
No no no. I didn't mean it in a bad way. I am just trying to find how to write in database without the DataAdapter.
Any idea?
I am starting to get a bit desperate :/
|
|
|
|
|
Well, if you want to replicate what the DataAdapter does, you'll have to:
- Create a
DbCommand and relevant parameters to delete a row; - Call
GetChanges(DataRowState.Deleted) on the DataTable ; - Iterate through the returned rows, assigning the relevant values to the parameters and executing the command to delete the row from the database;
- Create a
DbCommand and relevant parameters to update a row; - Call
GetChanges(DataRowState.Modified) on the DataTable ; - Iterate through the returned rows, assigning the relevant values to the parameters and executing the command to update the row in the database;
- Create a
DbCommand and relevant parameters to insert a new row; - Call
GetChanges(DataRowState.Added) on the DataTable ; - Iterate through the returned rows, assigning the relevant values to the parameters and executing the command to insert the row in the database;
If you're dealing with multiple tables, you'll need to ensure that you handle them in the correct order to make sure that you don't try to insert a child row before the related parent row.
If you want to add concurrency, you'll need to pass the original values of the relevant columns to your update and delete procedures. Use row[column, DataRowVersion.Original] to read the original value.
You'll probably want to wrap everything up in a DbTransaction to make sure the changes are atomic.
In short, it's a lot of work that you don't really need to do, as the DbDataAdapter already does it for you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|