|
Dear Sir: I'd like to create a column like "W" + "auto increment". "W" is a text and "auto increment" is like an auto increment column start from 1 to n (step 1). Would you please tell me how to do that?
Thanks
Shell Shell |
| shellhu 6 hours 3 minutes ago |
column? in what control ? listview, datagridview, etc. ? �trujade.�/font>
|
| �trujade.†5 hours 39 minutes ago |
Dear Sir: It is in text control.
Thanks
Shell Hu
Shell |
| shellhu 5 hours 22 minutes ago |
You need to be more explicit about what you want to do,
and What do you mean by "Auto Increment Column" ?
|
| Crazypennie 4 hours 45 minutes ago |
Do you mean "W" char + auto-increment in char?? Check the ASCII code of "W" then add by 1. If i m wrong, please explain to us by examples??
|
| Harrie KalaChakra 4 hours 41 minutes ago |
Dear Sir: What I want to do is as below: The first row: W0000001 When I insert another row in it will automatically insert W0000002
Thanks
Shell Hu Shell |
| shellhu 4 hours 35 minutes ago |
Mmmmm... Is this in Excel ? If it is, please post your question in the right forum at this link http://social.msdn.microsoft.com/Forums/en-US/isvvba/threads |
| Crazypennie 4 hours 26 minutes ago |
Dear Sir: No, it is in SQL2005. I want to use VB2005 to finish it.
Thanks
Shell Hu Shell |
| shellhu 4 hours 18 minutes ago |
Do you mean a multi-line textbox? If so, then the only way to identify that the user has 'inserted' a row is to catch the newline entry. When a new line is entered , look at the last line in the text box and append a new line that is the last line incremented by one. A text box is not a convenient control for this type of processing.
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.Lines.Count > 1 Then
If TextBox1.Lines(TextBox1.Lines.Count - 1) = "" Then
Dim T As String = TextBox1.Lines(TextBox1.Lines.Count - 2)
Dim NewLine As String = T.Substring(0, 1)
Dim N As Integer = CInt(Val(T.Substring(1))) + 1
NewLine &= N.ToString("000000")
TextBox1.Text &= NewLine
End If
End If
End Sub
|
| Acamar 4 hours 17 minutes ago |
auto-increment for voucher code:
voucher = "W0000001"
newvoucher = "W" & right("000000" & cstr(cint(right(voucher,7))+1),7)
|
| Harrie KalaChakra 4 hours 17 minutes ago |
Dear Sir: Maybe I didn't explain my want in good way. I create a column in SQL server 2005 and I want this column worked like I described way.
Looking for your help!
Thanks
Shell Hu Shell |
| shellhu 4 hours 2 minutes ago |
If those codes above aren't answer your question, then explain your question again in simplest way??
|
| Harrie KalaChakra 3 hours 37 minutes ago |
Dear Sir: I'd like to create a stored procedure to definite a column in SQL server to make it run automatically in my described way.
Looking forward to your help!
Thanks
Shell Hu Shell |
| shellhu 3 hours 12 minutes ago |
Stored Procedure?? You go wrong forum friend Go to this forum to get any suggestions about stored procedure http://social.msdn.microsoft.com/Forums/en-US/sqlgetstarted/threads |
| Harrie KalaChakra 3 hours 9 minutes ago |
Hi,
You ask samples, and everybody is guesssing and dropping it seems endless not relatedcodecopied from somewhere in this forum which has nothing to do with your question.
Show us in about 10 lines of code what you have done sofar and tell us what not is working.
As it is solely in your SQL transact code from the stored procedure, then know that SQL transact has a feature with integers to autoincrement (not with strings or other value types).
But in that case follow the link from Harrie.
Success Cor |
| Cor Ligthert 1 hour 28 minutes ago |