473,396 Members | 1,913 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

visual basic 2008 - Fax numbers are stored in database.

I have just finished creating a simple fax program - that can transmit, connect to the SQL DB, and query the customers table. How would I go about looping throught the list of phone numbers to transmit our availability to each customer. We have close to 1000 customer fax numbers after the query. Currently I've exported the list to a spreadsheet for testing.

Our fax server is a windows 2003 server with a rocket port modem and we have four fax lines. I would prefer after the query to transmit the faxes using two phone lines which can be configured on the server.. I would like to transmit the list in order - so a pause would have to be in place and if the distant line is busy to retry two times - then go to the next number. If anyone has any idea's it would greatly be appreciated.


Code:
<
Option Explicit On
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports Microsoft.Office.Interop

Public Class frm1
Inherits System.Windows.Forms.Form
'Declare variables for Fax server faxcomex library
Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
Dim objFaxServer As New FAXCOMEXLib.FaxServer
Dim JobID As Object
'Dim devices As FAXCOMEXLib.FaxDevice



'Declare varibles for DB connection
Dim conn As New ADODB.Connection ' This declares the name of the connection
Dim rst As New ADODB.Recordset ' This declares the name of the recordset
Dim sSQL As String ' Variable used to open the recordset
Dim DevNursery As String ' Connection string variable
Dim appExcel As Excel.Application
Dim wbkReport As Excel.Workbook
Dim wksReport As Excel.Worksheet
Dim intField As Integer, intRow As Integer
Dim dbstate As Integer



Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btntransmitt.Click




DevNursery = "Provider=SQLOLEDB;" & _
"DRIVER={SQLServer};" & _
"SERVER=Server3500\NurserySQL;" & _
"DATABASE=DevNursery;" & _
"Trusted_Connection=yes"




conn.Open(DevNursery)

dbstate = conn.State
sSQL = "SELECT SName,SAvailabilityFax FROM CustomersTbl where StoreNameID=25 and SAvailabilityFax is not null"
rst.Open(sSQL, conn)
rst.MoveFirst()
If Not rst.EOF Then
Do Until rst.EOF
MessageBox.Show("First record is: " & rst.Fields.Item("SName").Value)
rst.MoveNext()
Loop
Else
End If

rst.Close()
conn.Close()
rst = Nothing


objFaxServer.Connect("serverfax") 'Connect to the fax server

objFaxDocument.Body = "\\testPC\c$\test.txt" 'Document to transmit


objFaxDocument.Recipients.Add("11111111", "Todd") 'Number to dial for testing




JobID = objFaxDocument.ConnectedSubmit(objFaxServer)

MsgBox("The Job ID is :" & JobID(0))

'Set the cover page type and the path to the cover page
objFaxDocument.CoverPageType = FAXCOMEXLib.FAX_COVERPAGE_TYPE_ENUM.fcptSERVER

'objFaxDocument.CoverPageType.FAXCOMEXLib.FAX_COVE RPAGE_TYPE_ENUM.fcptNONE()
objFaxDocument.CoverPage = "generic"

'Provide the cover page note
objFaxDocument.Note = "Availability Sheet Nurseries"

'Provide the address for the fax receipt
objFaxDocument.ReceiptAddress = "emailaddress"

'Set the receipt type to email

objFaxDocument.ReceiptType = FAXCOMEXLib.FAX_RECEIPT_TYPE_ENUM.frtMAIL


'Set the receipt type to email
objFaxDocument.ReceiptType = FAXCOMEXLib.FAX_RECEIPT_TYPE_ENUM.frtMSGBOX

Exit Sub

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclose.Click
Close()
End Sub

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub

Private Sub frm1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click



DevNursery = "Provider=SQLOLEDB;" & _
"DRIVER={SQLServer};" & _
"SERVER=Server3500\NurserySQL;" & _
"DATABASE=DevNursery;" & _
"Trusted_Connection=yes"

conn.Open(DevNursery)
dbstate = conn.State
sSQL = "SELECT SName,SAvailabilityFax FROM CustomersTbl where SAvailabilityFax is not null and SAvailabilityFax <> '0000000000'"



appExcel = New Excel.Application
appExcel.Visible = True
wbkReport = appExcel.Workbooks.Add
wksReport = wbkReport.Worksheets(1)

rst.Open(sSQL, conn)
rst.MoveFirst()

If rst.EOF <> True Then
rst.MoveFirst()
intRow = 1
Do
For intField = 0 To rst.Fields.Count - 1
wksReport.Cells(intRow, intField + 1) = rst.Fields(intField).Value
'Name of column = .Name
'rst.Fields(intField).Name & "=" &
Next intField
rst.MoveNext()
intRow = intRow + 1
Loop Until rst.EOF = True
End If
Exit Sub


rst.Close()
conn.Close()
rst = Nothing
End Sub
End Class
>
Nov 11 '08 #1
0 1482

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: rodneybauer1 | last post by:
hello: thanks in advance for any responses. i dont have a isp at home so have to use public library computer. will check this every couple days though. im using visual basic.Net windows XP with...
11
by: Leon | last post by:
I have six textbox controls on my webform that allows the user to enter any numbers from 1 to 25 in any order. However, I would like to sort those numbers from least to greatest before sending them...
0
by: AJIT PITALE | last post by:
Hi, I am using Visual Basic 6 as front end and Visual FoxPro as a Database. I am trying to pass a parameter from VB to Visual FoxPro's Stored Procedure. I am getting an error showing "Data...
0
by: fiona | last post by:
Reading, Berkshire, UK 05 June 2007 - Crainiate Software make details available of the release of Objecto Framework 2.0, an upgrade to their enterprise business component framework, designed to...
6
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
5
by: Claudio M. E. Bastos Iorio | last post by:
Hi, anyone using VS2008 (final) on windows Vista? I have a problem. The ASP.NET web site administration tool on any site created by VS2008, running on Vista, is not working as it should. I can...
3
by: Saucer Man | last post by:
Is this only available as part of Visual Studio or can it be purchased separately? -- Thanks!
2
by: mdimitris | last post by:
Goodevening I am new to the community and I would like to post a question. I think the solution is simple I just couldnt find the right one. I want to build a simpe program that will manage an...
5
by: CAM | last post by:
Hello, I am using SQL Server Express 2008 for my database and Visual Studios 2008 - Visual Basic.Net for my forms. I Gone into VS 2008 and specify the source of data using the Data Sources...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.