|
OK..thank you..you already did a lot : )
modified 7-Jan-19 21:02pm.
|
|
|
|
|
Hii..
I need to know how to get continuous bill numbers, I have a query which gives Bill numbers Continuously for a month but once the month get ends the bill number will start from one again which is not required it should continue with the last bill numbers which was generated in last month...
The Query is...
stQuery = "SELECT MAX(substring(st_bill_no from 9 for 15)) FROM sc_bill WHERE dt_bill_date BETWEEN '" & _
Format(FirstDayOfMonth, "yyyy-MM-dd") & "' AND '" & _
Format(LastDayOfMonth.AddDays(1), "yyyy-MM-dd") & "'"
Thanks In Advance
|
|
|
|
|
Change the constraints so the dates do not cover just one month.
|
|
|
|
|
|
Drop all of the
Annapurna anu wrote: WHERE dt_bill_date BETWEEN '" & _
Format(FirstDayOfMonth, "yyyy-MM-dd") & "' AND '" & _
Format(LastDayOfMonth.AddDays(1), "yyyy-MM-dd") & "'"
and just leave the
Annapurna anu wrote: stQuery = "SELECT MAX(substring(st_bill_no from 9 for 15)) FROM sc_bill"
because you are not interested in the dates.
If you are still at the design stage, I'd have the st_bill_no split into its subcomponents as separate fields (e.g. chars 1 to 8, 9 to 23, and 24 onwards). You can then used the required middle part as a single numeric entity. What is currently st_bill_no could then be built as an expression field in views that use it; this would give you greater flexibility.
|
|
|
|
|
Without using a vb timer control, whats the best way to to get a known computer list of on off machines. (the app im making knows host names and ip's) Im just hoping there is a better solution than making my own service that i need to install and run each time the computer boots to communicate with my app.
Whats the best method of doing this? Do i need to make a service for each machine to communicate with my app? Ive been out of the loop for programming since visual studio 6. (10 yrs xp though) Back at it again...
Thanks for any links/pointers you may provide.
|
|
|
|
|
|
You have a choice to make.
To get a "real time" status, you must have a client on the target machines that checks-in with a central database to give it's status. Obviously, a machine that's off cannot give a status so the client application has to check-in when the user hits Windows Shutdown. It would also check-in with a status of Up when the app starts and possibly even check-in with that status every so often. This gives you a current status and you don't have to wait for a report to be generated.
Pinging every machine on the network will not give you a "real time" status, but the known status the last time the machine was pinged. If you have a small number of machines, this can give you a status of every machine fairly quickly. This status will fall farther and farther behind the larger the number of machines you have to get a status on. This gives the status of all machines but you have to wait for that status to be generated when you want the report.
To prevent this delay, to a point, you would have to have a service running on a server somewhere that just pings the machines all the time and updates the database. This will give a report of the status of the machines the last time it was pinged but you wont have to wait for the report to be generated. Again, even this will fall behind as the number of machines increases.
The problem with pinging machines is that the firewalls on them can be configured to block ICMP packets causing the pings to fail and look like the machine is off.
|
|
|
|
|
I have a Zebra printer that I need to send a character array to, so that it generates a barcode.
I have text and font maping working, by using a RichTextBox and using the Windows PrintDialog.
To send a barcode, I need to send something like this: "^XA^BY8,0^FT124,209^BON,8,N,0,N,1,^FDBase Material^FS^XZ"
The Printer is on a USB port ("USB002") and does not take the SerialPort.Open() command.
Here is my code, which works for other items on USB if I set the SerialPort.PortName = "COM1", just doesn't work for this printer...I'm out of ideas:
Try
SerialPort1.Open()
If Me.SerialPort1.IsOpen() Then
Dim buf(Command.Length) As Byte
For i As Integer = 0 To (Command.Length - 1)
buf(0) = Asc(Mid(Command, 1, 1))
Next
' send to Printer
Me.SerialPort1.ReadExisting()
Me.SerialPort1.Write(buf, 0, Command.Length())
' wait for response
Dim ReturnValue As Integer = -99999
Dim start_time As Integer = My.Computer.Clock.TickCount
Do Until (Me.SerialPort1.BytesToRead >= 8 Or DemoMode = True)
If My.Computer.Clock.TickCount > start_time + 1000 Then
DemoMode = True
MessageBox.Show("Printer Meter Timed Out")
Return ReturnValue
Exit Function
End If
Loop
Dim Results As String = Me.SerialPort1.ReadExisting()
Dim length = Results.Length()
If length < 8 Then
MessageBox.Show("Bad Value Sent To Printer")
Return True
End If
End If
Catch ex As Exception
MessageBox.Show(ex.ToString())
End Try
|
|
|
|
|
USB-Port and Serial-Port is not the same.
But normally, if you install a Driver on your System, you get an emulated Serial-Port for your USB-Device with which you can access it.
Have you took a look at the System-Configuration of your PC-System if there is such a Driver installed ???
|
|
|
|
|
I have taken a look and there is no such driver. I even contacted Zebra to see if I could modify the port name from "USB002" to COM, or even relocate the install, but no-go.
I'll try a different method.
Thank you for the help.
|
|
|
|
|
To print to a Zebra printer, you don't use the port; you just send a raw string directly to the printer.
Here's the C# class I use to do that: Raw printer helper · GitHub[^]
There's also a similar VB.NET version here on CodeProject: Print Direct To Windows Printer (EPOS Receipt)[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Thank you, I will give this a shot, and let you know how it goes.
|
|
|
|
|
please there's this birthday app an developing and i want it to automatically send message to users at there birthday. please i need your help
|
|
|
|
|
|
Sure. How can we help you?
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
In the code block below I am wishing to use a variable in a xxxx.Rows.Count line. Specifically, I'm wanting to take the "R1200s" portion and increment it to R1201s, R1202s, R1203s and so on as the For-Next loop executes.
I, of course, already have the DataTable()'s portion defined... no problem there. The code works fine if I write out every single instance but I'd like to shorten it up into a simpler block of code. I've been able to use "i" in every other control with success but getting hung up on only this portion.
I've tried something like ("R120" & i & "s"), along with many variations of this but, can find no solution that works with the limited experience I have with VbScript. Any help, a code example or a point in the right direction, is greatly appreciated.
For i = 1 To 8
Dim Ai As Label = DirectCast(Page.FindControl("A" & i.ToString()), Label)
Dim Si As Hyperlink = DirectCast(Page.FindControl("S" & i.ToString()), Hyperlink)
If R1200s.Rows.Count < Slots.Rows(0)(Ri).ToString() +1 Then
Ai.Style.Add("background-color","#000000")
Si.ImageUrl = "images/" & i & ".png"
Si.NavigateUrl = "step3.aspx?Time=" & i & "&Date=" & Request.QueryString("Date") & "&Day=" & Request.QueryString("Day") & "&Entry=" & Request.QueryString("Entry")
End If
Next
modified 24-May-17 2:20am.
|
|
|
|
|
|
What is R1200s? What type of object is it?
There are two kinds of people in the world: those who can extrapolate from incomplete data.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Have you tried
For i as integer = 0 to R1200s.Rows.Count-1
Next i
|
|
|
|
|
Hi,
I try to create an access 2007 or higher file.
I wrote this testcode just an simple form with 2 buttons.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnMake.Click
Dim dlg As New SaveFileDialog
With dlg
.Filter = "Access(.accdb)|.accdb"
If .ShowDialog = DialogResult.OK Then
Dim cat As New ADOX.Catalog()
Try
cat.Create("Provider=Microsoft.ACE.OLEDB.102.0;Data Source=" & .FileName & ";Persist Security Info=True")
'cat.Create("Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=" & .FileName)
Catch ex1 As Exception
MsgBox(ex1.Message)
If MsgBox("Is Microsoft Access Database Engine 2010 Redistributable installed?", vbQuestion Or MsgBoxStyle.YesNo) = MsgBoxResult.No Then
Try
Process.Start("<a href="https://www.microsoft.com/en-us/download/details.aspx?id=13255">https://www.microsoft.com/en-us/download/details.aspx?id=13255</a>")<br />
MsgBox("Do it :)", MsgBoxStyle.SystemModal)
Catch ex2 As Exception
End Try
End If
Finally
cat = Nothing
End Try
End If
End With
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btnOpen.Click
Dim dlg As New OpenFileDialog
With dlg
.Filter = "Access(.accdb)|.accdb"
If .ShowDialog = DialogResult.OK Then
Dim OLEConnection As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & .FileName & ";Persist Security Info=True")
OLEConnection.Open()
Dim OLECommand As New OleDb.OleDbCommand("", OLEConnection)
' Before this line you can create a string that holds your build for the table structure
Randomize()
Dim t As Int64 = Int(Rnd() * 100000)
Try
OLECommand.CommandText = "CREATE TABLE mytable" & t & " (field1 CHAR,field2 NUMBER)"
OLECommand.ExecuteNonQuery()
MsgBox("Table " & t & " maded")
OLECommand.CommandText = "insert into mytable" & t & " values(""" & t & """, " & t & ")"
OLECommand.ExecuteNonQuery()
OLECommand.Connection.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End With
End Sub
Create a table works. However making a file Always fails.
Can anyone gives me idaes?
I've tryed installing the 32 and 64 bit version of Microsoft Access Database Engine 2010 Redistributable
I'm working on a W10 machine 64bit
Jan
|
|
|
|
|
You are missing quite a bit of logic in creating the database. The sequence of events should be:
string connectionString = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0}", tbFilename.Text);
ADOX.Catalog cat = new ADOX.Catalog();
cat.Create(connectionString);
ADOX.Table adoxTable = new ADOX.Table();
adoxTable.Name = <table name here>
ADOX.DataTypeEnum dbType = <column data type>
adoxTable.Columns.Append(<column name>, dbType);
cat.Tables.Append(adoxTable);
ADODB.Connection con = cat.ActiveConnection as ADODB.Connection;
con.Close();
|
|
|
|
|
Thanks both for the help.
My sequence is the same as yours
Make file
add table
The difference is for making the tables: I use sql.
But it seems that making files won't work with framework 2.
Now with only changing to 4.52 it works
Jan
|
|
|
|
|
|
Hi - I use the Yahoo Finance API, to get Stock Quotes. The following code is showing a Status of 504. Does this mean that the service is discontinued or that the server is temporarily down? Can anybody suggest an alternative - where the function takes input of Ticker and Date, and gives output of Closing Price? Please ignore the error checks I am doing in the function below, since this is part of a larger macro and excuse the amateurish programming skills!
Public Function StockQuote(strTicker As String, Optional dtDate As Variant)
' Date is optional - if omitted, use today. If value is not a date, throw error.
If IsMissing(dtDate) Then
dtDate = Date
Else
If Not (IsDate(dtDate)) Then
StockQuote = CVErr(xlErrNum)
End If
End If
Dim dtPrevDate As Date
Dim strURL As String
Dim strCSV As String
Dim strRows() As String
Dim strColumns() As String
Dim dbClose As Double
dtPrevDate = dtDate - 7 'need a previous date cos of API Service
' Compile the request URL with start date and end date
strURL = "http://ichart.finance.yahoo.com/table.csv?s=" & strTicker & _
"&a=" & Month(dtPrevDate) - 1 & _
"&b=" & Day(dtPrevDate) & _
"&c=" & Year(dtPrevDate) & _
"&d=" & Month(dtDate) - 1 & _
"&e=" & Day(dtDate) & _
"&f=" & Year(dtDate) & _
"&g=d&ignore=.csv"
Set http = CreateObject("MSXML2.ServerXMLHTTP.6.0")
http.Open "GET", strURL, False
http.Send
strCSV = http.responseText
' The most recent information is in row 2, just below the table headings.
' The price close is the 5th entry
If http.readystate = 4 Then
If http.Status = 200 Then
strRows() = Split(strCSV, Chr(10)) ' split the CSV into rows
strColumns = Split(strRows(1), ",") ' split the relevant row into columns. 1 means 2nd row, starting at index 0
dbClose = strColumns(4) ' 4 means: 5th position, starting at index 0
Else
dbClose = 0
GlobalErrorCount = GlobalErrorCount + 1
End If
Else
dbClose = 0
GlobalErrorCount = GlobalErrorCount + 1
End If
StockQuote = dbClose
Set http = Nothing
End Function
|
|
|
|