|
i want to Store and retrieve data from web server (internet) from my desktop application which i developed in vb.net
can anyone give me the solution how to do this task.
|
|
|
|
|
You have to use "WebService" or "WCF", if you are on .NET 3.0.
|
|
|
|
|
hi Christian
Actually i want to store and retrieve data into my sql which is on web server.
Is it okey if i pass id address and userid,password in connection string in .net application?
|
|
|
|
|
ershad wrote: Is it okey if i pass id address and userid,password in connection string in .net application?
If your app is used on the same network as your users, or if your SQL Server is actually exposed so anyone can connect to it and run SQL on it ( a colossaly bad idea ). then yes.
Most intelligent people would write a webservice to do this.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian Graus wrote: Most intelligent people would write a webservice to do this.
I second that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hii
Add the Web reference in your project and create the instance of web reference and use the methods of your web service.
Thanx
~Khatri Mitesh
|
|
|
|
|
What web service ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Christian Graus wrote: What web service ?
Beats me. I didn't get the impression the OP already created a web service
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
if you can give ip, username and password to the sql server then
why not directly connect to the database and insert or retireve records.
If i am getting your point right then if its a desktop application then direct connection won't do any harm to the database.
|
|
|
|
|
hi.. could you pls help me solve this problem..i am just finding the way "how to import .csv or .txt file into listview control??" i have a code which is akin to it but it reads everything inside the file add to the listview only one line.. so how about line by line adding??... below is my code..
Private Function ReadTextFile(ByVal sFileName As String) As String
Dim s As String
Try
Dim oFile As FileStream = New FileStream(sFileName, FileMode.Open, FileAccess.Read, FileShare.Read)
Dim oReader As StreamReader = New StreamReader(oFile)
s = oReader.ReadToEnd()
oReader.Close()
oFile.Close()
ReadTextFile = s
Catch
ReadTextFile = "Unable to open file."
End Try
End Function
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim s As String
s = ReadTextFile(Environment.CurrentDirectory & "\ReadMe.txt")
ListView1.Items.Add(s)
'MessageBox.Show(s)
End Sub
|
|
|
|
|
File.ReadAllLines returns an array of strings which is a valid data source for a list view.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Learn something new every day, this is why I lurk here, thanks.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yeah thanks
I was always using a more complicated way of reading lines into an array
Lloyd J. Atkinson
"Logic will get you from A to B, but imagination will take you everywhere" - ALbert Einstein
I look at Microsoft, and turn to my poster on the wall saying: "Bang head here in case of stress".
|
|
|
|
|
Ok, well i am making a graphing calculator, and it's the simplest part i can't seem to figure out. I have a panel that is 416x416, which the graph will be drawn on. I have variables, xMin, xMax, yMin, yMax, that store the minimum and maximum for the x and y values. Now, the first step in rendering the graph is to draw the X and Y axises, and based on the minimum and maximum of the values will determine where the origin for the graph is. That's what i'm having problem with, i can't seem to generate code that will, in pixels, give the origin for the graph. Right now, the calculator only works if -xMin = xMax = -yMin = yMax, meaning the origin would be in the center of the 416x416 panel, at point (208, 208). If the xMax was twice as much as the -xMin, then the X axis would be 1/4 off of the panels left side. I can't seem to code an algorithm, when passed the xMax, xMin, ect., will return the origin of the graph. It will work with some values, but not all. Please let me know if i have not explained enough.
void Play() { try { throw Ball(); } catch (Glove) { } finally { Play(); } }
"Failure is only the opportunity to begin again, this time more wisely."
"Don't ask for a light load, but rather ask for a strong back."
|
|
|
|
|
have you tried (math.abs(xMin) + xMax) / 2
That is if xMin is "-200" and xMax is 400 the result is (200 + 400) / 2 = 300
EDIT: Unless you are already using negative values in X, Y then you would use
((math.abs(xMin) + xMax) / 2) - math.abs(xMin)
or
((200 + 400) / 2) - 200 = 100
|
|
|
|
|
A million thanks. I had tried something like that, but it was so complicated and didn't even work. Can't believe it was that simple.
void Play() { try { throw Ball(); } catch (Glove) { } finally { Play(); } }
"Failure is only the opportunity to begin again, this time more wisely."
"Don't ask for a light load, but rather ask for a strong back."
|
|
|
|
|
Hi everybody,
I built and app that uses threads for a number of task, and at the end of every routine I call the Abort() method for its respective thread. While looking at the thread count indicator at the Task Manager, I noticed that this indicator always increases while the Output window indicates that the threads had successfully exited.
Is this normal or am I doing something very wrong?
Thanks great minds for your guidance.
Alex.
|
|
|
|
|
alexvw wrote: I call the Abort() method for its respective thread
As MSDN says about Thread.Abort(), The thread is not guaranteed to abort immediately, or at all. It's always good to exit the threads rather than calling Abort() . Please post your code so that we can come up with better suggestions.
|
|
|
|
|
//Declare thread var
Private Shared BkGrthread As Threading.Thread
//call sub that starts the thread
Private Sub Frm_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
...
InitThread(BkGrthread, 1)
...
End Sub
//Sub that starts the thread
Private Sub InitThread(ByRef Thread As Threading.Thread, ByRef ThreadIndex As Byte)
Try
Select Case ThreadIndex
Case 0 : Thread = New System.Threading.Thread(AddressOf ReceiveWkStat)
Case 1 : Thread = New System.Threading.Thread(AddressOf ReceiveTCPMsg)
Case 2 : Thread = New System.Threading.Thread(AddressOf ReceiveSys)
End Select
Thread.IsBackground = True
Thread.Priority = System.Threading.ThreadPriority.Normal
Thread.Start()
Catch
Msg(Err.Description, 16, "FrmMain::InitThread")
End Try
End Sub
//the following code was not created by me, I copied and modified it to fit my needs (so far it seems to work!)
Private Sub ReceiveTCPMsg()
Dim _data(1024) As Byte
Dim iMsg(), _Message As String
Dim TCPIP As Net.Sockets.TcpClient
Dim Stream As Net.Sockets.NetworkStream
Try
TCPIP = UDPManager.AcceptTcpClient
Stream = TCPIP.GetStream : Stream.Read(_data, 0, 1024)
TCPIP.GetStream.Close()
Stream = Nothing : TCPIP = Nothing
_Message = System.Text.Encoding.ASCII.GetString(_data)
iMsg = _Message.Split(",")
Select Case iMsg(1)
Case 1 : Invoke(sLoadNewEvent, New Object() {iMsg}) '**New Event Insertion
Case 2 : Invoke(sRemoveEvent, New Object() {iMsg}) '**Event Deletion
Case 3 : Invoke(sItemUpdate, New Object() {iMsg}) '**Event Item Update
Case 5 : Invoke(sTimeChange, New Object() {iMsg}) '**Update Event's Time
Case 6 : Invoke(sStatusChange, New Object() {iMsg}) '**Update Event's Status
Case 7 : Invoke(sTypeChange, New Object() {iMsg}) '**Update Event's Type
Case 11 : Invoke(sNewEventData, New Object() {iMsg}) '**Event Data
Case 12 : Invoke(sDeleteData, New Object() {iMsg}) '**Del Event Data
Case 13 : Invoke(sMaintenance, New Object() {iMsg}) '**system Maintenance
Case 15 : Load_IncrementValues()
Case 99 : UnconditionalEnd()
End Select
Catch
Msg(Err.Description & Chr(10) & _Message & Chr(10) & Err.GetException.StackTrace, 16, "MainMod::ReceiveTCPMsg")
Finally
InitThread(BkGrthread, 1)
End Try
BkGrthread.CurrentThread.Abort()
End Sub
This is all the code involved. I am using VS2002 Fmwrk 1.1. Most subs modify several controls on the main thread, therefore the use of Invoke.
Please, feel free to laugh or cry upon this code
Thanks for your time.
<div class="ForumMod">modified on Saturday, August 16, 2008 7:20 AM</div>
|
|
|
|
|
|
What you talking about Willis ?
I am guessing Excel somehow, but you don't make it remotely clear.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi
I have two locations referenced by
point1 = A5
point2 = A10
I need to use these variables in a calculation ie
=sum(point1:point2)
however this doesn't work?
when I use this statement
ActiveCell.Offset(0, 3).Value = "=sum(point1:point2)
any work around / solution?
if you require additional info let me know?
|
|
|
|
|
Please don't ask twice. Please try to use intelligent headers. EVeryone here wants help. Please make it clear what you're asking about. Visual Basic.NET does not have any control which references locations by A5 and A10, or has an ActiveCell, It seems likely you're talking about Excel, but VBScript or interop ? How are we to tell ?
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Matthew Leggett wrote: I have two locations referenced by
point1 = A5
point2 = A10
I need to use these variables in a calculation ie
=sum(point1:point2)
however this doesn't work?
when I use this statement
ActiveCell.Offset(0, 3).Value = "=sum(point1:point2)
any work around / solution?
if you require additional info let me know?
Try this:
ActiveCell.Offset(0, 3).Value = "=sum(" & Point1 & ":" & Point2 & ")"
This is of course assuming that you have Point1 and Point2 declared as strings.
|
|
|
|
|
Does anyone know how to shutoff/disable the automatic "feature" of changing the time of a date field when changing time zones? I want my dates to be left alone. I know I can change the field to type string but extra conversions would be necessary to compensate for changing the type. (this auto-feature happens when I am using a webservice)
Thanks,
Nathan
'Never argue with an idiot; they'll drag you down to their level and beat you with experience.' ~ anonymous
'Life's real failure is when you do not realize how close you were to success when you gave up.' ~ anonymous
|
|
|
|