Click here to Skip to main content
15,897,704 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Nant Compiler.exe Error Pin
Christian Graus9-Oct-07 19:11
protectorChristian Graus9-Oct-07 19:11 
GeneralRe: Nant Compiler.exe Error Pin
sonigirish9-Oct-07 19:30
sonigirish9-Oct-07 19:30 
QuestionTo deploy a web application Pin
rockz...9-Oct-07 18:24
rockz...9-Oct-07 18:24 
AnswerRe: To deploy a web application Pin
Christian Graus9-Oct-07 18:30
protectorChristian Graus9-Oct-07 18:30 
AnswerRe: To deploy a web application Pin
Dhyanga11-Oct-07 0:20
Dhyanga11-Oct-07 0:20 
QuestionSSIS in ASP.Net 1.1 Pin
Falguni Joshi9-Oct-07 17:01
Falguni Joshi9-Oct-07 17:01 
QuestionExported data from grid to excel Pin
bigeyed9-Oct-07 15:21
bigeyed9-Oct-07 15:21 
QuestionReturning a Datatable in a Func results in empty table Pin
srone9-Oct-07 12:09
srone9-Oct-07 12:09 
This is driving me crazy. I used to do this in .net 1.1

The table will have rows in GetTable, but the client will have an empty table.

I used to return a ref to the table in GetTable...I shouldn't have to clone.

I've tried no clone, and cloning at the client call.
I've tried creating a new table at the client.
I've tried moving the function to the calling sub's class.
I've tried standing on my head.
I've tried rolling chicken bones and calling the spirits of my ancestors.

Please help if you can.

Thank you


Class DataHandler
Public Function GetTable(ByVal Query As String) As DataTable

Dim oCon As New SqlConnection(ConfigurationManager.ConnectionStrings("DispatchData").ConnectionString)

Dim oAdapter As New SqlDataAdapter(Query, oCon)
Dim oTable As DataTable

Try
Dim oDataset As New DataSet
oCon.Open()
oAdapter.Fill(oDataset)
oTable = oDataset.Tables(0)

'Table has x number of rows
Return oTable.Clone

Catch ex As Exception
Throw New Exception("Failed to read data", ex)
Return Nothing
Finally
oAdapter.Dispose()
oCon.Close()
End Try
End Function
End Class

Private SomeSub()
Dim oDataHndlr as new DataHandler
Dim MyQuery as string = "SELECT * FROM MyTable"

'Table will contain 0 rows
Dim oTable as DataTable = oDataHndlr.GetTable(MyQuery)

End Sub


AnswerPlace the Return outside of the Try block Pin
srone9-Oct-07 15:21
srone9-Oct-07 15:21 
QuestionIE vs. Firefox Pin
gates099-Oct-07 9:05
gates099-Oct-07 9:05 
AnswerRe: IE vs. Firefox Pin
Christian Graus9-Oct-07 18:31
protectorChristian Graus9-Oct-07 18:31 
AnswerRe: IE vs. Firefox Pin
Guffa9-Oct-07 20:58
Guffa9-Oct-07 20:58 
GeneralRe: IE vs. Firefox Pin
gates0910-Oct-07 2:37
gates0910-Oct-07 2:37 
QuestionTyping In Combo Pin
John.G9-Oct-07 8:57
John.G9-Oct-07 8:57 
AnswerRe: Typing In Combo Pin
il_masacratore9-Oct-07 21:46
il_masacratore9-Oct-07 21:46 
GeneralRe: Typing In Combo Pin
John.G18-Oct-07 8:47
John.G18-Oct-07 8:47 
Questionasp.net connection string Pin
omer erakman9-Oct-07 7:36
omer erakman9-Oct-07 7:36 
AnswerRe: asp.net connection string Pin
Not Active9-Oct-07 8:20
mentorNot Active9-Oct-07 8:20 
GeneralRe: asp.net connection string Pin
omer erakman9-Oct-07 9:37
omer erakman9-Oct-07 9:37 
AnswerRe: asp.net connection string Pin
Dhyanga11-Oct-07 0:25
Dhyanga11-Oct-07 0:25 
GeneralRe: asp.net connection string Pin
omer erakman11-Oct-07 6:40
omer erakman11-Oct-07 6:40 
GeneralRe: asp.net connection string Pin
Dhyanga13-Oct-07 19:31
Dhyanga13-Oct-07 19:31 
GeneralRe: asp.net connection string Pin
omer erakman14-Oct-07 8:54
omer erakman14-Oct-07 8:54 
GeneralRe: asp.net connection string Pin
Dhyanga14-Oct-07 21:31
Dhyanga14-Oct-07 21:31 
QuestionASP .Net 2.0 Page events. Pin
aakar9-Oct-07 6:25
aakar9-Oct-07 6:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.