Click here to Skip to main content
15,909,896 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Sevices with command interface Pin
Dave Kreskowiak26-Apr-05 2:35
mveDave Kreskowiak26-Apr-05 2:35 
GeneralTextBox value Pin
nitin_ion25-Apr-05 20:06
nitin_ion25-Apr-05 20:06 
GeneralRe: TextBox value Pin
vertig073026-Apr-05 1:08
vertig073026-Apr-05 1:08 
GeneralRe: TextBox value Pin
nitin_ion26-Apr-05 1:10
nitin_ion26-Apr-05 1:10 
GeneralRe: TextBox value Pin
toxcct26-Apr-05 20:35
toxcct26-Apr-05 20:35 
GeneralPrint Pin
Steveko7725-Apr-05 20:04
Steveko7725-Apr-05 20:04 
Generalretrieve data from data base and get it into the excel sheet Pin
nidhishri25-Apr-05 19:56
nidhishri25-Apr-05 19:56 
GeneralRe: retrieve data from data base and get it into the excel sheet Pin
Mandar Patankar26-Apr-05 7:33
Mandar Patankar26-Apr-05 7:33 
Hi Nidhishri

I guess this code snippet shoulld solve your problem.


Dim ExcelApp As New Excel.Application
Dim ExcelWorkBook As Excel.Workbook
ExcelWorkBook = ExcelApp.Workbooks.Add
Dim TemplateSheet As New Excel.Worksheet
TemplateSheet = ExcelWorkBook.Sheets.Add
TemplateSheet.Name="SQLDATA"

Dim SQLData As New SqlDataAdapter("YOUR QUERY FOR GETTING DATA",DatabaseConnection)
SQLDATA.SelectCommand.Parameters.Add("PARAMETERS IF REQUIRED)
SQLDATA.SelectCommand.Parameters(0).Value = "VALUES FOR PARAMETERS"

Dim Myrow As DataRow
Dim SQLdatatable As New DataTable
Try
SQLDATA.Fill(EquationNormDataTable)
Catch ex As Exception

End Try


Dim StartRowForFile As Integer = 1
StartRowForFile += 1
For Each Myrow In EquationNormDataTable.Rows
'Now u can iterate through each rows of the table and populate data in an excel sheet
Dim ColCount As Integer = 1
For ColCount = 1 To 3
TemplateSheet.Cells(StartRowForFile, ColCount).Value = Myrow(ColCount - 1)
Next
StartRowForFile += 1
Next


'now u can save the excel file
ExcelWorkBook.SaveAs(""FILENAME WITH COMPLETE PATH")

Mandar Patankar
Microsoft Certified professional
GeneralCrystal Report with multiple dataset Pin
Suman Singh25-Apr-05 16:31
professionalSuman Singh25-Apr-05 16:31 
GeneralRe: Crystal Report with multiple dataset Pin
vertig073025-Apr-05 16:44
vertig073025-Apr-05 16:44 
GeneralRe: Crystal Report with multiple dataset Pin
Suman Singh26-Apr-05 23:12
professionalSuman Singh26-Apr-05 23:12 
GeneralTab Control Navigation Pin
Suman Singh25-Apr-05 16:27
professionalSuman Singh25-Apr-05 16:27 
GeneralRe: Tab Control Navigation Pin
Robert Rohde25-Apr-05 19:59
Robert Rohde25-Apr-05 19:59 
QuestionHow to command the other control in a difference form in vb.net Pin
Mekong River25-Apr-05 15:58
Mekong River25-Apr-05 15:58 
AnswerRe: How to command the other control in a difference form in vb.net Pin
Dave Kreskowiak25-Apr-05 17:17
mveDave Kreskowiak25-Apr-05 17:17 
GeneralRe: How to command the other control in a difference form in vb.net Pin
Mekong River26-Apr-05 22:34
Mekong River26-Apr-05 22:34 
Generalcreating an employee database need code help please Pin
crshbrn1425-Apr-05 15:03
crshbrn1425-Apr-05 15:03 
GeneralRe: creating an employee database need code help please Pin
Dave Kreskowiak25-Apr-05 17:10
mveDave Kreskowiak25-Apr-05 17:10 
GeneralOpen two tables in one form Pin
msnick25-Apr-05 14:53
msnick25-Apr-05 14:53 
GeneralRe: Open two tables in one form Pin
Mike the Red27-Apr-05 9:33
Mike the Red27-Apr-05 9:33 
GeneralRe: Open two tables in one form Pin
msnick28-Apr-05 15:32
msnick28-Apr-05 15:32 
GeneralHi!!!Want some help!!! Pin
shekkk25-Apr-05 12:41
shekkk25-Apr-05 12:41 
GeneralRe: Hi!!!Want some help!!! Pin
Len Miller25-Apr-05 15:32
Len Miller25-Apr-05 15:32 
GeneralCalculating the latidude and longitude of an area Pin
Martin@captivasystems25-Apr-05 10:16
Martin@captivasystems25-Apr-05 10:16 
GeneralRe: Calculating the latidude and longitude of an area Pin
msnick25-Apr-05 15:52
msnick25-Apr-05 15:52 

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.