|
Hi,
Thanks for the reply! But I do not really understand what paragraph 2 meant..
"If the DataSet contains ForeignKeyConstraint objects, invoking the AcceptChanges method also causes the AcceptRejectRule to be enforced." -- You mean foreign key in database? But I think my database have a foreign key but AcceptChanges can be used on my DataGridView. (I decided to use that)
telly
|
|
|
|
|
Hello every one. I am defining my problems in detail
I have a vb 2005 Express application
I have been trying to make the payments functionality better
What my intention is to add a new grid and have 4-5 columns
- Serial number
- Date
- Type / Details
- Quantity
- Amount
With all other fields I am able to manage, I am having issues with only one of them
Type/Details
Hear I want to have a combo box which has all the predefined options from DB. On select of any option I want the appropriate price to come
I there is something which is not defined in DB the user should be in a position to type and enter a price also, that is, I want a drop down combo box not a drop down list
User should be in a position to add new rows also
How can I do it..
modified on Thursday, December 27, 2007 6:33:03 AM
|
|
|
|
|
You can use ComboBoxColumn for Type/Detail.
But as for your second part of the question, I am not so sure, you may want check if you can set the ComboBoxColumn dropdownstyle to DropDown, and whether it will set the Text to values that is not in the combo box's items during binding.
Failing so, you may want to use a custom column, instead.
|
|
|
|
|
I suggest you to use the DatagridViewComboboxColumn and DatagridViewTextBoxColumn into a DatagridView.
You should google a little and focus on what you need. For other problem during your development, you will be able to post specific problems and we will help you.
Shay Noy
|
|
|
|
|
I have done something like that with data bound items. You select combobox in Form design view and then click on the sign in the upper right corner of combobox picture. There you select checkbox use bound items and then select apropriate data source, value member and, data member. If you have stored pricess of separate model types in a different table, you will have to make relations between tables to work properly.
|
|
|
|
|
Hi,
I have a datagridviewcomboboxcolumn and I would like to change the selectionbackcolor.
I success in part:
I change the selectionbackcolor to cyan but when I am selecting other item the backcolor of the previous stll cyan
Here is a snippet of my code:
Private Sub EditingControlCombobox_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs)
If e.Index = -1 Then Exit Sub
e.DrawBackground()
Dim brsh As SolidBrush, Fnt As Font
Dim backBrush As SolidBrush
If CType(sender, DataGridViewComboBoxEditingControl).SelectedIndex = e.Index Then
backBrush = New SolidBrush(Color.Cyan)
Else
backBrush = New SolidBrush(Color.Empty)
End If
If e.Index = 0 Then
brsh = New SolidBrush(Color.Purple)
Fnt = New Font("Times New Roman", 10, FontStyle.Italic)
Else
brsh = New SolidBrush(Color.Black)
Fnt = EditingControlCombobox.Font
End If
e.Graphics.FillRectangle(backBrush, e.Bounds)
backBrush.Dispose()
e.Graphics.DrawString(NegotiationItemList.Items(e.Index).ToString, Fnt, brsh, e.Bounds)
brsh.Dispose()
End Sub
Thank you
Shay Noy
|
|
|
|
|
I guessing that you have not put the color changing code in your selectedIndexChanged event. Because you have to select a different index before you can edit, I'd put my code there to change the color back to what you want.
Just because we can; does not mean we should.
|
|
|
|
|
Sorry, I don't understand what you mean.
Shay Noy
|
|
|
|
|
hi all
i have created a stored procedure in sql server with two parameters
todate and from date
i want to generate a crystal report using above procedure
i have no idea about what to write in add command of report for
executing a stored procedure with parameters
if anyone have any idea pls suggest
|
|
|
|
|
Look around on google for examples
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi,
I hav a code for import data from excel to sql server. This code used to import data totally. That is, already some data in excel imported the whole data to sql server.The code is,
Dim excelConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;"""
Dim connection As OleDbConnection = New OleDbConnection(excelConnectionString)
Try
Dim command As OleDbCommand = New OleDbCommand("Select ID,Data FROM [Sheet1$]", connection)
connection.Open()
Dim dr As OleDbDataReader = command.ExecuteReader
Try
Dim sqlConnectionString As String
'= WebConfigurationManager.ConnectionStrings("CampaignEnterpriseConnectionString").ConnectionString
sqlConnectionString = "Data Source=rafik-vzi7iicz1\sa;Initial Catalog=Excel;Integrated Security=True"
Dim con As SqlConnection
con = New SqlConnection(sqlConnectionString)
Dim bulkCopy As SqlBulkCopy = New SqlBulkCopy(sqlConnectionString)
Try
bulkCopy.DestinationTableName = "Exceldata"
bulkCopy.WriteToServer(dr)
Finally
CType(bulkCopy, IDisposable).Dispose()
End Try
Finally
CType(dr, IDisposable).Dispose()
End Try
Catch ex As Exception
Finally
CType(connection, IDisposable).Dispose()
End Try
MsgBox("imported successfully", MsgBoxStyle.Information)
The code is working perfectly.
My problem is, i need to import the data by character wise. That is, suppose i typing some word in excel, the word automatically saved in sql server by character wise.
Any idea Plz tell me.
Suggestions also appreciate.
Plz help me.
|
|
|
|
|
kamarudeen wrote: i need to import the data by character wise.
What do you mean by "character wise"??
|
|
|
|
|
character wise means cell by cell. That is the data imported to sql server cell by cell.
For ex:
excel sheet:
CELL 1 CELL 2 CELL 3 CELL 4
DATA: VELU RAMU RAMU KATHER
KAMAR SIDDIQ SADIQ SEERR
this is sample data. I need to import data every cell by cell.
|
|
|
|
|
hello
I want to know why this error "Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException'.
now i'm tracing why this error occurr, but can't find yet.
if someone has experience with this error, please help me and send me message.
phoopwint
flowerppk
|
|
|
|
|
AxHost is a class that hosts ActiveX (COM) components on your form. You have a COM-based control that you added to your form that is misbehaving.
|
|
|
|
|
Dear programmers,
Can anyone give me the code to make the data displayed in the datagrid or HFlexGrid editable and then save that in the database.
I urgently need that for my project in the job.
Thanks one and all
Keshav Singh Developer in C++ and VB
|
|
|
|
|
Keshav Singh Sunwar wrote: urgently
Very impolite.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi Paul,
Keshav here to whom you replied a few hours back. I m extremely sorry for the words I used in my message.
Actually I need to do the same at any cost before this weekend, that was the reason 4 the message.
I am trying to make datagrid editable by inserting a textbox on the click event of the Flexgrid for each cell clicked.
I hope it will work out.
Thnx for the message
keshav
Keshav Singh Developer in C++ and VB
|
|
|
|
|
I think Dave's reply is the better one
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
This[^] is about the best information you're going to get on creating an editable MSFlexGrid.
|
|
|
|
|
I am using VB 2005. trying to create wilcard parameter search. I don't know how to connect variamble Name to the one using in SQL statements.
SQL lines in Query builder:
SELECT ID, Ime, Priimek, [Službeni telefon], [Službeni GSM], [Domaci telefon], [Privatni GSM], [Elektronska pošta], [Domaci naslov]<br />
FROM SLUŽBA<br />
WHERE (Priimek LIKE '%' & '@NAME' & '%')
And in Form2 I have this code inside button1 object:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim NAME As String<br />
<br />
NAME = TextBox1.Text<br />
<br />
<br />
Try<br />
Me.SLUŽBATableAdapter.FillBy2(Me.TelefonskiImenikDataSet.SLUŽBA, NAME)<br />
Catch ex As System.Exception<br />
System.Windows.Forms.MessageBox.Show(ex.Message)<br />
End Try<br />
End Sub
can anyone tell me what is wrong here and correct the code, please.I've b een researching a lot and don't find a proper solution. Please Help. The builder doesn't report any error but the button doesn't do a query parameter wildcard search. Variable NAME is underlined with green waveline.It says too many arguments to function FillBy2.
|
|
|
|
|
BOREC wrote: '@NAME'
Remove the apostrophes around the parameter. The apostrophes tell SQL Server to expect a string literal value.
|
|
|
|
|
Could it be that wildcard parameter search doesn't work because I use Express edition version of the program?
When I remove the apostrophes the wizard alerts: Erros in WHERE clause near '@'. Unable to parse query text.
I tried a lot ways to create a FillBy2 function with apropriate SQL statements and then call the function in Button_click subroutine but it doesn't work. Has anyone done this at home or office?
Can someone post the whole code so I can analyze it. Comments very welcome.
Bye
|
|
|
|
|
You can pad the value entered by user with '%' before sending it as parameter, ie
1. User type in 'abc'
2. In your code, pad the value to '%abc%'
3. Set the padded value to the parameter.
So your selection will just be:
WHERE (Priimek LIKE @NAME)
By the way, your original selection statement always search for '%@NAME%' <-- no longer a parameter.
|
|
|
|
|
I understand this. But what puzzles me is that when I create parameter search using this SQL statement
SELECT...
FROM ...
WHERE ( Priimek = ?) the wizard automaticaly creates a function FillBy
the wizard automaticaly creates a function FillBy(Priimek) With a variable Priimek which I can use in this statement
Me.SLUŽBATableAdapter.FillBy2(Me.TelefonskiImenikDataSet.SLUŽBA, PriimekToolStripTextBox.Text)
But when I create a function with SQL statement
WHERE (Priimek LIKE @NAME)
I get a function with no parameter. The wizard simply puts it out as FillBy2()<-no parameter.
I want to create a parametrized wildcard search. When I write "Klaj" out of "Klajnšek" Lastname in TextBox1 I want that the program displays all records with letters "klaj" in LastName like "Klajnšek" or like "Priklajdorin". I hope you understand.
Thank you for help
modified on Thursday, December 27, 2007 7:55:50 AM
|
|
|
|