|
|
|
Ok thank you guys. But can any one help me with this? My program would have a initial setup screen where the system admin will suply all the necessary informatoin such as the server name, pasword, username and stuff like that... all this information would be written to a text file somewhere on the hard drive. The program should then take the server name, user name and password from the text file to create the connection string to connect to the database (sql 2000)
How do i go about using the information from the text file to create my connection string so that my program can use it? I can't program the connection string in the project because i don't know the name of the server they will be using and they might need to put it on other servers..
Please help!!
Nab
Nab
|
|
|
|
|
JustmeNick wrote: How do i go about using the information from the text file to create my connection string so that my program can use it?
string.Concat() ?
|
|
|
|
|
that doesn't say much..give a an example..plz
Nab
|
|
|
|
|
JustmeNick wrote: that doesn't say much..give a an example..plz
String.Concat works like this:
String.Concat("Server=", serverName, ";Database=", databaseName)
However, I don't know enough about how you need your connection string to be made up.
Sorry, but if you want more then you'll have to give more. Be more explicit in your request.
|
|
|
|
|
I must have bypass that section in the book i was reading... I am just saying thank you for helping me out... now i can use this information to read from an xml file or a text file..so that the system admin will be able to configure their system when ready for use...
this is what i did just for testing...and it worked like a charm..thanks to you guys... if i didn't get this part..my project would be stuck..
Dim severname As String = InputBox("Enter server name...")
Dim databasename As String = InputBox("Enter database name...eg DBfhms")
connectionString = String.Concat("server= " + servername.Trim + "; packet size=4096; trusted_connection=true; database= " + databasename.Trim)
above is just a test run..if you notice i don't have any user name or password..i think it is much better if i let the system admin control that part from windows by adding the user to a group so only those persons in that group would be able to access the system's data.. what do u guys think..is that the right approach or should i supply a user name and a password for the connection string?..
...
Thanks again..guys..
Nab
|
|
|
|
|
JustmeNick wrote: i think it is much better if i let the system admin control that part from windows by adding the user to a group so only those persons in that group would be able to access the system's data.. what do u guys think..is that the right approach or should i supply a user name and a password for the connection string?..
Yes, allowing trusted connections is more secure than adding a user name and password.
Just remember that once you have your connection string to cache somewhere (in memory during the course of the application - not to disk) it and keep using the cached version. If you end up with two bits of code that create a connection string and they are in any way different (even although they evaluate to the same database with the same credentials) you won't get the benefits of connection pooling.
|
|
|
|
|
JustmeNick wrote: pasword, username and stuff like that... all this information would be written to a text file somewhere on the hard drive
I wouldn't leave the password out in plain text.
|
|
|
|
|
ok..but how do i develop the connection string at runtime...sql server
Nab
|
|
|
|
|
|
Cannot marshal field 'table' of type 'MIB_TCPTABLE': Invalid managed/unmanaged type combination (Arrays fields must be paired with ByValArray or SafeArray).
i got this error when trying to call function GetTcpTable.. see the following code..
[module declaration]
Structure MIB_TCPROW
Dim dwState As Long
Dim dwLocalAddr As Long
Dim dwLocalPort As Long
Dim dwRemoteAddr As Long
Dim dwRemotePort As Long
End Structure
<structlayout(layoutkind.sequential, charset:="CharSet.Ansi)"> Structure MIB_TCPTABLE
<marshalas(unmanagedtype.byvaltstr, sizeconst:="100)"> Dim table() As MIB_TCPROW
Dim dwNumEntries As Long
End Structure
Public v_MIB_TCPTABLE As MIB_TCPTABLE
Declare Function GetTcpTable Lib "IPhlpAPI.dll" (ByVal pTcpTable As MIB_TCPTABLE, ByVal pdwSize As Long, ByVal bOrder As Long) As Long
[form code]
Dim tcpt As MIB_TCPTABLE
Dim l As Long
Dim x As Integer
Dim i As Integer
Dim RemA As String
Dim LocP As String
Dim RemP As String
Dim state As Integer
l = Len(v_MIB_TCPTABLE)
GetTcpTable(tcpt, l, 0)
x = tcpt.dwNumEntries
after calling GetTcpTable function i got exeption as mention above
please help
|
|
|
|
|
It looks like you've found and are using an old VB6 definition of the structures, not compatibile with VB.NET. A 32-bit integer is called Integer in VB.NET, not Long. That was the old VB6 name for it. Long under VB.NET is a 64-bit integer. If you don't get this correct, you can imbalence the call stack.
The function declaration should be this:
Declare Function Auto GetTcpTable Lib "IPhlpAPI.dll" ( _
ByVal pTcpTable As MIB_TCPTABLE, _
ByVal pdwSize As Integer, _
ByVal bOrder As Boolean) As Integer
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi all,
First of all - Wishing you all a Happy & Prosperous New Year 2007...
My Prob:-
I hv developed a web application. I wanna use it in my Local Intranet with my machine as a Server. This web page can b seen on my machine, if I type my Computer name in my Internet Explorer, but due to some reasons i m not able to see this page on any other machine. Its says "Page cannot be found"
My machine is accessible to all this system if you try it thru windows explorer, but still the web page cannot b seen.I think there is some prb with the IIS settings bcoz even i changed the default web page & kept IIS web page as a default web page,it is still not accesible.
I m not able to trace out wht exactly the prb is. Pls help me to get the soln.
Thanx in advance.
|
|
|
|
|
Can the other machines resolve your machine names address? open up a CMD prompt on those machines and type PING machineName . If it comes back with a response, then it can resolve your machine name and there's something else wrong. It's possible that you're not using the correct path after the name.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hii Dave,
I tried to ping my machine frm 2-3 diffrent machines & I was successful. So i dont think there is any prb in connectivity, but still the page is not displayed.
Regarding path: As the system is in LAN, I type http://mymachinename on the other machines. Even i hv entered my machine name in the Bypass proxy server for foll.address textbox on the other machines, still its not working.....wht can b the prb???
|
|
|
|
|
You're possibly not typing the correct path into the address box. It should be a folder under the Inetpub\wwwroot folder on your machine.
http://yourmachine/applicationfolder
or possibly
http://yourmachine/applicationfolder/pagename.aspx
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I hv tried these things but still its not working. Now i m getting confused abt this prb.
Can u tell me what r the settings required to be done in IIS ?
|
|
|
|
|
You say it works from your own machine but not from remote machines. I have no idea what the problem could be now. IIS is running, the site is running, the path is correct, the name of the machine is resolvable. It should be working. I'd go back and reverify everything. After that, I have no idea what the problem is.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ok. I will hv to search some more factors affecting it.Even after removing VB.Net program from the picture, IIS is not able to display its default web page on the network. So i think prb lies in either of two things:- IIS settings or network settings.
Thanks for the help.
|
|
|
|
|
Dear friends,
Can I use any alternate for DSO Framer control to display document, excel, ppt, pdf etc files. I tried aspose too, but it was
not meeting our requirements. Because they want a tool which takes the documents as it is like DSO Framer. In aspose to
change the document format we need to change the code also.
And I need to email this document too. So that document may be changed so frequently. And dont forget that document must have
to be made using .Net frame work library(com component is not preferable). What shoud I use in this case. Please help me.
Thank you.
S/W Engineer
Akebono Soft Technologies
aleem_abdul@akebonosoft.com.
|
|
|
|
|
Stop cross posting in all the forums! This will NOT get you an "immediate reply", as you call it. It's likely to get you ignored.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: Stop cross posting in all the forums!
I've mentioned that to the OP and he cross posts even more
|
|
|
|
|
Must be something in their Cheerios...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave Kreskowiak wrote: Must be something in their Cheerios...
|
|
|
|