|
hi,
i and updating my data gridview cell pragmatically.data is showing in the cell. but not updating but if i typed same value in that cell it is updating.
my code is
Dim conn As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source=SQG-133;User Id=" & My.Forms.LoginForm.UsernameTextBox.Text & ";Password=" & My.Forms.LoginForm.PasswordTextBox.Text & ";Initial Catalog=" & My.Forms.LoginForm.tb_database.Text & "")
'update statement----
conn = da_inv.SelectCommand.Connection
da_inv.UpdateCommand = New SqlCommand()
da_inv.UpdateCommand.Connection = conn
da_inv.UpdateCommand.CommandText = "UPDATE dbo.dt_finnance_value_adition SET bank_doc_ref_no=@bank_doc_ref_no WHERE fund_id = @fund_id"
With da_inv.UpdateCommand.Parameters
.Add("@fund_id", SqlDbType.Int, 0, "fund_id")
.Add("@bank_doc_ref_no", SqlDbType.NChar, 10, "bank_doc_ref_no")
End With
'update statement end
da_inv.Update(ds_inv, "inv_table")
|
|
|
|
|
The parameters you are adding contain string literals, you should be using the variables, trying to stuff "fund_id" into an .Int parameter is going to cause problems!
.Add("@fund_id", SqlDbType.Int, 0, "fund_id")
.Add("@bank_doc_ref_no", SqlDbType.NChar, 10, "bank_doc_ref_no")
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I tried this code to display the data in dGV on the form, but it display the datat as a inclined,not as it show in the DGV , row after row.
For i As Integer = 0 To Me.DataGridView1.Rows.Count - 1
For j = 0 To DataGridView1.ColumnCount - 1
Dim g As Graphics
g = Me.CreateGraphics()
Dim str As String = Me.DataGridView1.Rows(i).Cells(j).Value
Dim y, X As Integer
y += 20
X += 30
g.DrawString(str, New Font("Times New Roman", 12, FontStyle.Regular), Brushes.DarkGreen, X, y)
Next
Next
|
|
|
|
|
Dim y, X As Integer
y += 20
X += 30
What are these values supposed to represent? I think you need to initialise them with something meaningful.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
need to initialise them with something meaningful.
I didn't found any way about how to use them(X,Y)
|
|
|
|
|
Mangore75 wrote: I didn't found any way about how to use them(X,Y)
Then why are you using them, do you understand what they are for?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I used them y=y+1 and x=x+1 as I think that will print row after row and column after column after column, as I know by little information that I have.
by the way I'm not professional in using VB I'm still beginner.
|
|
|
|
|
Yes but you have not initialised them to any starting point before you add the offsets.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
And then:
1. g = Me.CreateGraphics() is an expensive operation; why is it inside nested loops?
2. Graphics is one of those classes that offer a Dispose method; so if you create (or order creation) of an instance, you should dispose of it too.
Taken together, create once, dispose once.
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
|
Because you care about the environment, and don't want big, expensive objects lingering around, possibly holding unmanaged resources, huge memory blocks, system resources, whatever. If you created it and it has a Dispose, call it when done with it.
More[^]
Luc Pattyn [My Articles] Nil Volentibus Arduum
Fed up by FireFox memory leaks I switched to Opera and now CP doesn't perform its paste magic, so links will not be offered. Sorry.
|
|
|
|
|
In VBA for excel I can lift a table from a website using the QueryTables.Add method.
Here is what I use within an existing excel page...
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.Website.com/Subdir", Destination:=Range("$A$1"))
.Name = "TableName"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlAllTables
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
As you can see, this polls the website and then looks for the table on that website that I need to connect to.
However, I would like to do the same thing within a VB.Net application.
What method would I need, and are there any pointers you good people could help me out with?
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
You can use the MSHTML library. The web page is a html document - so you can use a CreateDocumentFromURL and then read the returned document as a html tree.
HTH
|
|
|
|
|
Thanks, I knew there had to be a way!
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
CCC Link[ ^]
Trolls[ ^]
|
|
|
|
|
I have a database with two tables Customers an loans. Customer table contain customer details like id, name, address etc. Loans table contain details of loans taken by customers like loan id, customer id, loan amount. I want to generate a report showing all customers and their loan amount regardless whether customers took loans or not. I tried to do this but it shows only customers who took loans. But i want to show all customers. How can i do this
|
|
|
|
|
That depends on the SQL query you used to get the data. Let's see it. Chances are, you're probably not using a LEFT OUTER JOIN to get all the records on the Customer side of the join.
BTW, this has nothing to do with VB.NET...
|
|
|
|
|
Dear all,
Please help to create pdf viewer in VB (only viewer - disable Save, SaveAs, Print options)
thanks
Jackson..
|
|
|
|
|
Please don't repost your question.
|
|
|
|
|
how to del. my repeated question
|
|
|
|
|
There should be a delete option in your post.
|
|
|
|
|
Not if there's a reaction to it - we wouldn't want orphaned reactions.
Bastard Programmer from Hell
|
|
|
|
|
Dear all,
Please help to create pdf viewer in VB (only viewer - disable Save, SaveAs, Print options)
thanks
Jackson..
|
|
|
|
|
|
thanks. but that codings is allow to SaveAs the file to another location..
actually wat i want na... that pdf viewer is not give access to do saveAs, Print, etc .......only to view the pdf file..
thanks..
|
|
|
|
|
..that means that there's a physical file, doesn't it. What's to stop me from opening that file using Acrobat?
Bastard Programmer from Hell
|
|
|
|