|
i was only wondering if it could be done
since there is "item" in executereader
ty
|
|
|
|
|
If WHAT could be done? You still haven't explained what your trying to do...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
rephrase:
is it possible to retrieve a data without using a datareader? (aside from executescalar)
is was wondering coz i saw "Item" in executereader
Dim oleCmd As New OleDbCommand("SELECT FldName " & _
"FROM TableName", oleCon)
With oleCmd
variable = .ExecuteReader.Item("FldName").ToString
End With
tnx in advance
-- modified at 20:46 Sunday 19th February, 2006
|
|
|
|
|
There are many ways to read a recordset. But, I'm repeating myself....What are you trying to do with this data???????? This will have a large impact on how you read it!!!!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
honestly nothing
im only experimenting on the "item" i found in datareader
|
|
|
|
|
WHY DIDN'T YOU SAY THIS IN YOUR FIRST POST?!?!?!?!
Private Sub Button2_Click(blah, blah) Handles Button2.Click
Dim conn As New OleDbConnection("connectionString")
Dim comm As New OleDbCommand("SELECT * FROM MyTable", conn)
Dim dr As OleDbDataReader
conn.Open()
dr = comm.ExecuteReader(CommandBehavior.CloseConnection)
Dim ID As Integer
While dr.Read()
ID = dr.Item("TableColumnName")
End While
dr.Close()
End Sub
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
coz i didn't see it relevant
need not shout though
asking nicely
question wasnt still answered
might not be possible to to use the "item" in executereader
without using datareader in retreiving data
variable = executereader.item("fldname")
tnx anyway
|
|
|
|
|
It works. I just showed you how to use it.
You saw the Item property come up because the ExecuteReader method returns an OleDbDataReader object, which is the thing exposing the Item property.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi Guys!! Im trying to debug my Project in VB.NET 2005 having .NET Framework 2.0.
Im getting this weird Exception called MissingFieldException. It gives the following Message:
Field not found: System.Collections.Generic.KeyValuePair`2.Key'.
This is its Stack Trace if of Any Help:
at BTSharp.Client.TorrentDownloader.Seed()
at BTSharp.Client.TorrentDownloader.SeedingPoll() in C:\Documents and Settings\David\Desktop\BTSharp\2.0_source\btSharp\Client\TorrentDownloader.cs:line 817
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
PLZ if anybody has heard of this Exception or know how to tackle the Problem, Reply back. Thanx!!
Devraj Raut!!!
|
|
|
|
|
|
Trying to write a new service on our application server that sends and gets ftp files to a remote server via ftp.
written something like this in vb6 before but want to try .net since the framework is there.
Not the sure of the best way to set up the timer in .net? in vb6 i would attach a form with a timer and LOAD that form from the main. This would cause the service to fire on specific interval and check for new files.
Any recommendations? Can't even seem to get the LOAD frm to work.
thx
|
|
|
|
|
You should use the System.Timers.Timer[^] class.
Also, if you're making a Windows Service, then you should not be using forms.
-- modified at 16:18 Friday 17th February, 2006
|
|
|
|
|
Hi,
I'm trying to query some data into a listview.
When there is more than one row of data on the listview, how can I choose a specific row to be displayed into a new form?
-----------------------------------------
MyQuery1 = "SELECT Date, Author, Comments, Ratings FROM [books] WHERE [name] = '" & txtbooksname.Text & "' "
Do While Not rs1.EOF
Set anItem1 = lvwRvw.ListItems.Add(, , rs1(0) & vbNullString)
For m = 1 To rs1.Fields.Count - 1
anItem1.SubItems(m) = rs1(m) & vbNullString
Next m
rs1.MoveNext
Loop
------------------------------------------
example:
Row Date Author Comments Ratings
1 01/01/2005 aaa romance B-
2 01/02/2004 bbb advanture B+
3 01/02/2005 bbb advanture B
How can I get the details of row 2 to be displayed on a new form?
Thank you very much.
|
|
|
|
|
Take a look at the ListViews Items collection. Each listitem has a collection of subitems.
My Blog[^] FFRF[^]
|
|
|
|
|
|
Hi all,
Until now we used to send stored procedure and ask the client to execute it using SQL Query Analyzer. Now we are supposed to do that through vb.net. I have a vb.net form with a multiline text box. User selects the stored procedure that gets displayed in text box. Now how do I execute this stored procedure? I tried using command object but it does not work. Below is sample stored procedure:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_InsertInCharges]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_InsertInCharges]
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE sp_InsertInCharges(@strRemarks As Varchar(100), @intTrnNr As Integer)
AS
declare @AccNr as int
declare @RoutingAccNr as int
declare @AmountDue as float
declare @strSQL as varchar(4000)
INSERT INTO Charges(ShipNr, ChargeID, Transaction_Nr, Sales_TrnNr, Partial_Sales_Nr, Charge_Date, Account_Nr,
Routing_Account_Nr, Cruise_Nr, Department_Code, Amount, IsTaxApplicable,
TaxType, TaxAmount, TaxPercent, Gratuity, Discount, Amount_Due, Charge_Type,
Payment_Type, Remarks, Bill_Number, User_Nr, Bill_Settled, Ex_Transaction_Nr,
ExcursionID, Event_Source,SettlementStatus)
SELECT ShipNr, ChargeID, Transaction_Nr, Sales_TrnNr, Partial_Sales_Nr, Charge_Date, Account_Nr,
Routing_Account_Nr, Cruise_Nr, Department_Code, Amount, IsTaxApplicable,
TaxType, TaxAmount, TaxPercent, Gratuity, Discount, Amount_Due, Charge_Type,
Payment_Type, @strRemarks As remark, Bill_Number, User_Nr, Bill_Settled, Ex_Transaction_Nr,
ExcursionID, Event_Source,SettlementStatus FROM Charges
WHERE Transaction_Nr = @intTrnNr
Set @strSQL = 'Select Account_Nr, Routing_Account_Nr, Amount_Due into Chargestemp from Charges WHERE Transaction_Nr = ' + Cast(@intTrnNr as varchar)
Exec @strSQL
set @strSQL = '
Select Account_Nr, Routing_Account_Nr, Amount_Due into Chargestemp from Charges WHERE Transaction_Nr = ' + Cast(@intTrnNr as varchar)
Exec (@strSQL)
declare Charges cursor for
Select Account_Nr, Routing_Account_Nr, Amount_Due * -1 from Chargestemp
open Charges
fetch next from Charges into @AccNr, @RoutingAccNr, @AmountDue
while @@fetch_status=0
begin
IF @RoutingAccNr <> Null or @RoutingAccNr <> ''
EXEC sp_UpdateDepositLimit @AmountDue, @RoutingAccNr
ELSE
EXEC sp_UpdateDepositLimit @AmountDue, @AccNr
fetch next from Charges into @AccNr, @RoutingAccNr, @AmountDue
end
close Charges
DEALLOCATE Charges
drop table Chargestemp
DELETE FROM Charges WHERE Transaction_Nr = @intTrnNr
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
|
|
|
|
|
Dim conn As New SqlConnection
conn.ConnectionString = Session("ConnectionString").ToString
Dim cmd As New SqlCommand
cmd.Connection = conn
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "dbo.yourProc"
Dim Prm1 As New SqlParameter("yourParam", SqlDbType.Int)
Prm1.Direction = ParameterDirection.InputOutput
cmd.Parameters.Add(Prm1)
Prm1.Value = Your Value
conn.Open()
cmd.ExecuteNonQuery()
conn.Dispose()
cmd.Dispose()
"People who never make mistakes, never do anything."
My Blog
|
|
|
|
|
Hi there,
Sorry .... I did not explain it properly. Now me try to explain. The above sample I posted is my stored procedure. Now this SP is on my machine. I send this to my client. My client will use SQL Query Analyzer to first run this script that will create this stored procedure in SQL Server. Now what I need is that my client should not use SQL Query Analyzer to "create" this SP. We want to load this script in text file and then create this SP through .NET. Is there any way to create SQL Query Analyzer object in .NET and run this?
Regards,
Vilas
|
|
|
|
|
|
I am trying to populate a combobox from a dataset/tableadapter. Is this possible?
Thanks
Brad
|
|
|
|
|
|
Hi All,
I have an interesting problem. I have a form with a DriveListBox control on it. I have a subroutine that is suppose to list the folders on the selected drive. The subroutine is from the Visual Basic help.
Subroutine:
Sub ShowFolderList(strPath As String)
Dim fs As Object
Dim f, f1, fc, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(strPath)
Set fc = f.SubFolders
For Each f1 In fc
s = s & f1.Name
s = s & vbCrLf
Next
MsgBox s, , "ShowFolderList"
End Sub
The purpose of this subroutine is to list the folders for the designated path. So if I enter “C:” I should get a list of the folders listed in the C: drive. But when I input C: for the drive I get these values coming into the ShowFolderList subroutine.
Drive = C:
? strPath
c:
? f
C:\Program Files\Microsoft Visual Studio\VB
Why is it showing the above path when I selected only C:?
But when I select a different drive I get this:
Drive = F:
? strPath
f:
? f
F:\
This one will list all the folders in the F: drive, because the F: has a backslash on it. While the C: didn’t. But when I select the C: drive again I get the same thing with the C drive as I have previously shown, but if I concatenate a “\” onto the Drive1.Drive call it will work like it should.
All this brings up the question why do I need to concatenate a backslash onto a C drive call to return the folders, but I don’t have to concatenate one on any other drive?
Thank you,
Quecumber256
|
|
|
|
|
Quecumber256 wrote: But when I select the C: drive again I get the same thing with the C drive as I have previously shown, but if I concatenate a “\” onto the Drive1.Drive call it will work like it should.
Because you're not specifying a complete path when you enter "C:". Since you didn't specify the root directory, "C:\", the rest of the path will be built using the current directory, in your case, C:\Program Files\Microsoft...
It works for the other drives because the current directory on those drives is the root, "F:\".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave,
Its strange because all the DriveListBox does is show the drive letter. By default it should start at the root directory and work it way down.
Thank you,
Quecumber256
|
|
|
|
|
Yes, it returns a drive letter, but it returns a string representing ONLY the drive letter, not a complete path. It's your responsbility to do any fixup of this string so there is no ambiguity when you pass it to whatever function your calling.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|