|
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
|
|
|
|
|
Adobe reader is give the permission to SaveAs & print.. but i need to view the pdf file without the option SAVEAS & Print...
|
|
|
|
|
So? I'll simply download CutePDF to print the file.
If the file is on the computer of the user, then the user becomes the owner of that file. You can't prevent the owner from manipulating his/her files.
Bastard Programmer from Hell
|
|
|
|
|
I'm converting an old VB6 application to VB2010 and I've run across a situation I can't seem to figure out from the books I have and web posts so your help will be appreciated.
The problem is iterating through a recordset assigning values to 20+ fields and then doing an update batch.
So far all I've been able to figure out is to use an OleDBCommand class and ExecuteNonQuery method and create individual UPDATE SQL commands for each of the 20+ fields I'm dealing with. I'm hoping there is a simpler way similar to the old ADO UpdateBatch.
Here's sort of what my old VB6 code looks like:
Set Conn = New ADODB.Connection
Conn.Open strDSNName
Set rs = New ADODB.Recordset
gstrSQL = "SELECT * from Judges;"
Set rs.ActiveConnection = Conn
rs.CursorLocation = adUseClient
rs.CursorType = adOpenStatic
rs.LockType = adLockBatchOptimistic
rs.Open strSQL
Conn.Close
Set Conn = Nothing
rs.MoveFirst
Do Until rs.EOF
rs.Fields("Response3").Value = rs.Fields("Response2").Value
rs.Fields("AssignedCat3").Value = rs.Fields("AssignedCat2").Value
...
20 more lines setting field3 to field2
...
rs.MoveNext
Loop
Set Conn = New ADODB.Connection
Conn.Open strDSNName
rs.ActiveConnection = Conn
rs.UpdateBatch
rs.close
set rs = nothing
conn.close
set conn.close
Thanks
|
|
|
|
|
MSDN[^] has a page on the topic.
Bastard Programmer from Hell
|
|
|
|
|
Thank you for taking the time to point me in this direction. I have been looking at the dataadapter. Unfortunately (for me), having never seen a VB snippet that applies to my situation I'm sort of lost, especially since I have never used "Parameters" in an update statement. It is sometimes difficult for me to understand a concept without a real life example.
Thanks (still hoping for a code sample from someone that sort of addesses my VB6 snip)
|
|
|
|
|
Member 8605177 wrote: still hoping for a code sample
Also on MSDN, using a DataTable [^]
Bastard Programmer from Hell
|
|
|
|
|
since I've never users parameters i have a question - assume my table consists of 20 fields. does that mean I need to define 20 parameters, one for each field?
|
|
|
|
|
Yup.
Bastard Programmer from Hell
|
|
|
|
|
Is there any workarounds on how to read the data from sql join using sqldatareader.
query ="SELECT TABLE1.FID FROM TABLE2 WHERE TABLE1.ID = TABLE2.ID"
Dim sqlRead As SqlDataReader
cmd.CommandType = CommandType.StoredProcedure
sqlRead = cmd.ExecuteReader
While sqlRead .Read()
Dim str as String = sqlRead("FID")
End While
Yes, I know that the good solution is to put "AS" clause on query.
Let say, TABLE1.FID AS FID.
But the problem is I have 100 StoredProcedures and each has no alias.
It's very difficult if I will modify all the SP just to put that clause.
Thanks in advance
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
You can retrieve datareader results by using the index, like this:-
While dr.Read
Dim id As String = dr(0).ToString()
id = dr.GetString(0)
id = dr.GetInt32(0)
id = dr.GetDateTime(0)
id = dr.GetDecimal(0)
End While
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
thank you for quick reply.
i found out also that if i will not put dr.read in an if statement, it causes an error. weird.
like this...
if dr.read then
while....
endif
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
I would change your
if dr.read then
to
if dr.hasrows then
This is a check to see if the datareader has any rows in its collection. further reading Datareader.hasrows[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
|
|
|
|
|
how can i read the datareader backward.
let say i have data
number=1,2,3,4,5,6,7,8,9,10.
dr(number)
in dataset,
ds.Tables(0).Rows.Count - 1 To 0 Step -1
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
You can't read a datareader backward as it is a forward only reader. You will have to do an order by on your sql query to return the rows in the order you wish them. i.e
SELECT id, name FROM employees ORDER BY id DESC or something like that.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Hi,
Wayne's suggestion is viable, but using index numbers instead of field names is not recommended, because your code will become harder and harder to maintain, when you add more fields to your query.
Generally speaking you may want to adapt your code thus:
If sqlRead.HasRows Then
Dim str as String = String.Empty
Do While sqlRead.Read()
str = sqlRead.Item("FID").ToString
End While
End If
If your query has only a single field with the name FID, the DataReader will automatically translate FID to TABLE1.FID.
Just as a matter of interest, are you using MS SQL or some other DB, because I can't get your query to work? In other words, what I am wondering is, the problem may simply be the query, and not so much the code.
Cheers,
Johan
My advice is free, and you may get what you paid for.
|
|
|
|