|
XPS describes an image of a printed page, not the data in it, kind of like PostScript or HP's PCL. The .NET Framework, nor anything else for that matter, has no methods to turn the file back into the data that generated it. Basically, the file is useless to you.
You have to find some other way to export the data from that app or have it print in some other format that can output plain text or an XML file, or find some kind of export function in it.
|
|
|
|
|
Okay, that is what I was afraid of. Back to the drawing board.
|
|
|
|
|
I have used some data mining software in the past for just this sort of thing. Have a look at Monarch[^] by DataWatch.
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
XPS is just XML compressed with zip. (If you change the file extension from .xps to .zip, you can view the contents with WinZip)
Once you figure out how to load it into VB.Net, (try looking up PrintDocument) you should be able to traverse the XML. Depending on the format of the report, you should be able to recover the data into a usable format.
But that sounds like a lot of work to avoid if possible
|
|
|
|
|
Can any1 help me.
am developing an email client that works fine behind an internet connection which is automatic and has ip address assigned by a router on the network
When i move to a different environment which uses a proxy server and port to connect to the internet, the email fails to send.Thank you.
Pete
phatkin
|
|
|
|
|
You're going to have to consult with the people who run your proxy server. Normally, you'd tell your client to connect to the proxy server, not the SMTP server. The proxy would then connect to the SMTP server for you. How you tell the proxy server which server to connection to for you is determined by the proxy.
|
|
|
|
|
Please this is my code...and our Proxy server is 192.168.1.5 with port 8080, i want to know a little about what you are telling me before i o to see the ppl at the server room. Am in school
My email class code here
............................
Imports System.Net.Mail
Imports System.Threading
Imports System.ComponentModel
Public Class Email
Dim n As newMail
'''
''' This is a class library for sending emails with attachments
''' created by PETER ANKOMAH
''' '''
''' <remarks>
Public Sender As MailAddress
Public Receipients As New MailAddressCollection
Public Subject As String
Public Body As String
Public Priority As MailPriority
Private Credentials As System.Net.NetworkCredential
Public Smtp As SmtpClient
Public email As New MailMessage
Public HtmlBody As Boolean
Public DelivNotification As New DeliveryNotificationOptions
Public ReplyTo As MailAddress
Public Cc As New MailAddressCollection
Public at As Net.Mail.AttachmentCollection
Private Attach As Net.Mail.Attachment
Public Bcc As New MailAddressCollection
'Public handler As New SendCompletedEventHandler(AddressOf SendcompleteCallBack)
Public mainsp As newMail
Public EmailName As String
Public datestamp As Date
'Public Sub SendcompleteCallBack(ByVal sender As Object, ByVal e As AsyncCompletedEventArgs)
' Dim msg = CStr(e.UserState)
' If e.Cancelled Then
' n.WLabel1.Text = "Message Cancelled"
' ElseIf Not e.Error Is Nothing Then
' n.WLabel1.Text = "Error Occurred:" & e.Error.ToString
' Else
' n.WLabel1.Text = "Message Sent Successfully"
' End If
'End Sub
Public Sub SetSMTPClient(ByVal Host As String, ByVal Port As Integer _
, ByVal EnableSSL As Boolean)
Smtp = New SmtpClient
With Smtp
.Host = Host
.Port = Port
.EnableSsl = EnableSSL
End With
End Sub
Public Sub SetCredential(ByVal Username As String _
, ByVal Password As String)
'we create new structure credential instance
Credentials = New Net.NetworkCredential
' Credentials.Domain = domain
Credentials.UserName = Username
Credentials.Password = Password
End Sub
Public Sub AddAttachment(ByVal fileName As String)
Attach = New Net.Mail.Attachment(fileName)
' at.Add(New Net.Mail.Attachment(fileName))
email.Attachments.Add(Attach)
' MsgBox("Attach added")
' Attach.Dispose()
End Sub
Public Sub SendEmail()
' AddHandler Smtp.SendCompleted, handler
Dim obj As Object
With email
.From = Sender
For Each obj In Receipients
.To.Add(obj.ToString)
Next
.Subject = Subject
If HtmlBody = Nothing Then
HtmlBody = False
End If
.IsBodyHtml = HtmlBody
.Priority = Priority
.ReplyTo = ReplyTo
For Each obj In Cc
.CC.Add(obj.ToString)
Next
For Each obj In Bcc
.Bcc.Add(obj.ToString)
Next
.Body = Body
End With
obj = Nothing
With Smtp
.Credentials = Credentials
.EnableSsl = True
End With
Try
Dim result As String = "going!!!!"
Smtp.SendAsync(email, result)
Catch ex As Net.Mail.SmtpException
MsgBox(ex.ToString)
End Try
'Smtp = Nothing
'email.Dispose()
End Sub
End Class
phatkin
|
|
|
|
|
There's nothing to change in the code other than the IP address of the server. You have to give it the IP of the proxy server, and somehow (this is where talking to the proxy people comes in!) specify the SMTP server you're going to use to send the mail. It's also entirely possible that this isn't going to work at all because the SmtpClient class doesn't really support using a proxy server.
|
|
|
|
|
Thank you sooo much. Am about to talk to the Proxy pple but i hope the visual basic team can see my problem. Am a die-hard microsoft fun and want everything possible with VB.
SMTP CLASS SHOULD SUPPORT PROXY SERVERS
phatkin
|
|
|
|
|
prubyholl wrote: Am a die-hard microsoft fun and want everything possible with VB.
Everything is possible in a definite route. When you follow the route, you can reach the destination.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
There are other 3rd party libraries that do fully support proxies. ALl you have to do is Google for ".net smtp client proxy" to find them.
|
|
|
|
|
|
I used the design view to create a datagrid connection, adapter and dataset.
I the code view i have
ResCasesDataSet2.Clear()
ResCasesSqlDataAdapter.Fill(ResCasesDataSet2)
However i get an error "Login failed for user ' '"
This worked perfectly when i used access database but not with Ms Sql Server.
jesa
|
|
|
|
|
Your SQL server has a password set. The default is user 'sa' and password 'password' (I think). You need to generate a connection string; to do that you need the password. Talk to whomever is administering your database.
|
|
|
|
|
I have a connection string with a username and password which connects, opens but still throws an error "Login failed for user ' ' "
on the code line
ResCasesSqlDataAdapter.Fill(ResCasesDataSet2)
JESA
|
|
|
|
|
I am in the process of rewriting an application from VB6 to .Net2005. The application currently uses an access database and has a Order Control Table where the next order number is stored.
How can I retrieve and update the next order number in a single step (if possible) to prevent multiple users from getting the same next order number.
Thank you,
digicd1
|
|
|
|
|
Since Access doesn't support stored procedures, what you do is really just a hack.
The only way I can see this happening is creating a remote Singleton object that handles creating a new order using the latest order number. Since a single can only have one instance of the object at any one time running, all the client have to use this one instance.
But, a simpler method is to just create the order (without the order number) and let the database assign an autonumbered id to it which becomes your order number, or a part of it.
|
|
|
|
|
Simply use a table with an AutoNumber field. When you add a record to the table, you don't specify any value for the AutoNumber field, it will be automatically created. You then run the query "select @@identity" to get the number that was created for that record.
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Why not consider upsizing your Access database to a MS SQL Server Express database, then use a stored procedure?
Steve Jowett
-------------------------
It is offen dangerous to try and see someone else's point of view, without proper training. Douglas Adams (Mostly Harmless)
|
|
|
|
|
<br />
<br />
#Region "Insert record into Outbound_Login_Details table with AgentId,login time and other details"<br />
Public Sub INSERT_AGENT_DETAILS()<br />
Try<br />
con.Open()<br />
Command.CommandText = "usp_Outbound_Login_Details"<br />
Command.CommandType = CommandType.StoredProcedure<br />
Command.Parameters.Add("@Agent_ID", SqlDbType.BigInt).Value = AgentID<br />
Command.Parameters.Add("@Extno", SqlDbType.VarChar, 50).Value = g_Extension_Number<br />
<br />
Command.Parameters.Add("@Outbound_Login_id", SqlDbType.BigInt)<br />
Command.Parameters("@Outbound_Login_id").Direction = ParameterDirection.Output<br />
dataReader = Command.ExecuteReader()<br />
g_OutBound_Login_ID = CInt(Command.Parameters("@OutBound_Login_ID").Value)<br />
'Command.ExecuteNonQuery()<br />
'<br />
Catch ex As Exception<br />
lblerror1.Text = ex.Message<br />
Finally<br />
dataReader.Close()<br />
con.Close()<br />
End Try<br />
<br />
End Sub<br />
#End Region<br />
<br />
<br />
****************<br />
CREATE PROCEDURE usp_Outbound_Login_Details <br />
( <br />
@Agent_ID BIGINT , <br />
@Extno VARCHAR(50),<br />
@IPAddress VARCHAR(50) = 0 <br />
)<br />
AS<br />
BEGIN<br />
SET NOCOUNT ON<br />
DECLARE @LoginDateTime AS DATETIME <br />
SET @LoginDateTime = GETDATE() <br />
INSERT INTO Outbound_Login_Details WITH (ROWLOCK) ( Agent_ID , Login_Time , ExtNo,IPAddress ) <br />
VALUES ( @Agent_ID , @LoginDateTime , @ExtNo,@IPAddress ) <br />
SELECT Outbound_Login_ID <br />
FROM Outbound_Login_Details (NOLOCK)<br />
WHERE <br />
Agent_ID = @Agent_ID AND <br />
Login_Time = @LoginDateTime AND <br />
Extno = @ExtNo<br />
END<br />
<br />
GO<br />
<br />
this vb.net code gives me <br />
ex.Message = "Procedure or function usp_Outbound_Login_Details has too many arguments specified."<br />
Please what wrong in vb.net code.....<br />
<br />
<br />
|
|
|
|
|
Your Command object is likely a field on the class. Every time you call the method INSERT_AGENT_DETAILS() you add more parameters to the Command . So, it will fail the second, and subsequent time, the method is called.
|
|
|
|
|
Simple. You didn't specify all the parameters for the SQL Procedure, plus you added one that isn't in the parameter list for it.
This is the list of parameters your SQL Proc is expecting:
@Agent_ID BIGINT ,
@Extno VARCHAR(50),
@IPAddress VARCHAR(50) = 0
You gave it these parameters:
@Agent_ID
@Extno
@Outbound_Login_id
The proc doesn't return any values in a "@Outbound_Login_Id" parameter. It returns a table with a single column called "Outbound_Login_ID".
|
|
|
|
|
hi man
Number one try to change you Procedure to be like this, you have Complicated things in your Procedure, remember the order of declaration is important in your Procedure
<br />
Create Procedure usp_OutBound_Login_Details<br />
(<br />
@Agent_ID BIGINT , <br />
@Extno VARCHAR(50),<br />
@LoginDateTime AS DATETIME,<br />
@IPAddress VARCHAR(50) = 0 <br />
)<br />
as<br />
Insert into OutBound_Login_Details With(RowLock) (Agent_ID , ExtNo,Login_Time,IPAddress)<br />
Values( @Agent_ID,@Extno,Getdate(),@IPAddress)<br />
SELECT Outbound_Login_ID <br />
FROM Outbound_Login_Details (NOLOCK)<br />
WHERE <br />
Agent_ID = @Agent_ID And<br />
Login_Time = Getdate()<br />
AND Extno = @ExtNo<br />
<br />
<br />
number two your Procedure Expect Parameters and you did not supply them from your Sub, i see that you are supplying values
but where does those values come from? do they fly into the Sub from nowhere ?
number three you have Declared a variable "@IPAddress" and initialized it to 0, and now
your procedure that you are calling from your vb code need that parameter and you did not supply it. Why dont you make an IP address
a default value of "0" and dont include it in your Procedure, see how i got rid of the @LoginDateTime variable, you are wasting resouce's.
And in your Procedure does not tell us that you want to receive an Output from this Procedure, we only see your intensions in
your vb code.You have done a lot of mistakes both in vb and in SQL. i suggest you Google and try step by step to spent time
on your Procedure and after that you will know that you want to receive an output from a Procedure, remember to put
output keyword when you declare a variable to will carry an output for you.In your vb.net code be in mind that you are supposed supply an input
make sure that you show us how you get those inputs after that you must come back and show us what you did.
Dont worry i learnt from Dave and Colin that is why am like this
hope it helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hi!
Here is my code and I am getting an error message when I execute it (OleDBException - No value given one or more parameters). I couldn't figure out what is causing the error because all the given parameters are correct. However when I remove the last line from SQL string it is working fine. I assumed that I can use more than one condition after WHERE caluse in the string but it seems that it only accepts only one.
Thanks.
Juneyt
<br />
Dim mySelectQuery As String = "UPDATE " & WhatTable & " SET "<br />
<br />
mySelectQuery += "VMeaning=" & "'" & Replace(TextBox1.Text, "'", Chr(34)) & "',"<br />
mySelectQuery += "Description=" & "'" & Replace(TextBox2.Text, "'", Chr(34)) & "',"<br />
mySelectQuery += "Thoughts=" & "'" & Replace(TextBox3.Text, "'", Chr(34)) & "'"<br />
mySelectQuery += " WHERE OderNumber=" & SorahNumber <br />
<br />
'When I cancel the line below, it is working fine<br />
mySelectQuery += " AND VNumber=" & CInt(ComboBox3.SelectedItem) <br />
<br />
<br />
<br />
Dim myconnection As New OleDbConnection(SQLConnStr)<br />
Dim myCommand As New OleDbCommand(mySelectQuery, myconnection)<br />
<br />
myconnection.Open()<br />
<br />
myCommand.ExecuteNonQuery() 'error occurs here<br />
myconnection.Close()<br />
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
HI,
It seems to me that the OleDbProvider thinks that there is a parameter in your SQL command. Do any of your inputs contain a question mark, which denotes a parameter in OleDb? I would suggest you to use a parameterized SQL statement then pass all your textbox values as parameters using OleDbParameter. Below is the code snippet for the same:
-------------------------------------------------------------------------
BEGIN CODE
Dim strEditCommand As String = "UPDATE " & WhatTable & " SET "
strEditCommand += " VMeaning = ?, Description = ?, Thoughts=?, "
strEditCommand += " WHERE OderNumber=? AND VNumber= ? "
Using con As New OleDbConnection(SQLConnStr)
Using cmd As New OleDbCommand()
cmd.Connection.Open()
cmd.CommandText = strEditCommand
cmd.Parameters.Add(New OleDbParameter("VMeaning", TextBox1.Text))
cmd.Parameters.Add(New OleDbParameter("Description", TextBox2.Text))
cmd.Parameters.Add(New OleDbParameter("Thoughts", TextBox3.Text))
con.Open()
cmd.ExecuteNonQuery()
End Using
Con.Close()
End Using
END CODE
-------------------------------------------------------------------------
I hope this helps .
Regards,
John Adams
ComponentOne LLC
|
|
|
|