|
ok. thanx. now i understand. But pls how do i get this done. Plus, what about if i'm trying 2 connect my windows application to an online server (like on my website, www.mysite.com)? He who goes for revenge must first dig two graves.
|
|
|
|
|
|
Creamboy wrote: what about if i'm trying 2 connect my windows application to an online server (like on my website, www.mysite.com)?
If you're talking about connecting to an SQL Server over the internet, forget it. Noone in their right mind would EVER expose an SQL server directly to the Internet. You would notmally expose SQL functionality at the application level through a Web Service and have your app use the web service to do the work.
|
|
|
|
|
Get a little lost in the messages?
His first question was about finding sql servers on his network...which there are ways to do that (see Tosch's response below for one). He was told by someone that apparently doesn't know a whole lot about it that it was a ridiculous idea. So, he instead asked how he would connect to a server he knew about.
If you're trying to connect to an online server you just need to know what kind of server you're dealing with.
If you know that, check out http://www.connectionstrings.com/[^] for examples.
|
|
|
|
|
No, not lost. Just commenting on what appeared to be a request to connect to an SQL Server directly connected to the 'Net.
what about if i'm trying 2 connect my windows application to an online server (like on my website, www.mysite.com)?
|
|
|
|
|
Try Sql.SqlDataSourceEnumerator.Instance.GetDataSources
This will give you a datatable with a row for each SQL-Server found in the network. Please read the helpfile for further info.Tosch
|
|
|
|
|
|
I need help with a library computer system I'm creating. I am using ADODC to connect an MS Access database with my VB 6.0 project. As of now, I am working on a save function which saves records of reference materials on a particular table and, at the same time, saving a note on a separate audit trail table. The syntax for this code goes like:
'Note:
'AdoAudit is the ADODC that connects the audit trail table and the project
'AdoRec is the ADODC that connects the table of reference materials and the project
Private Sub cmdSave_Click()
tim = Now
AdoAudit.Recordset.AddNew
AdoAudit.Recordset.Fields("Operation") = "Added or Altered Reference Material"
AdoAudit.Recordset.Fields("DateDone") = Format(tim, "mm-dd-yyyy")
AdoAudit.Recordset.Fields("TimeDone") = Format(tim, "hh:mm:ss ampm")
AdoAudit.Recordset.Update
AdoRec.Recordset.Update
End Sub
The five lines with the AdoAudit are the codes I thought of for the audit trail table. It adds a new line in the said table and fills it with the operation done (in this case, saving a new reference material), the time it was done as well as the date before saving the said record.
However, whenever I run the program, it stops when I click cmdSave and Run-Time Error 91 "Object variable or With block variable not set". The highlighted syntax would be the five aforementioned lines involving AdoAudit. The save command for AdoRec, on the other hand, functions properly.
This is a major problem which prevents me from finishing the system. I have tried everything I know to fix this setback but, unfortunately, none of them fail to work. I am only a 2nd year IT student so I am not well versed on VB 6.0. Can anyone please help me with this problem using ADODC? Also, if possible, do you know what causes the stated error in VB 6.0 as well as means on how to remedy/avoid it?
|
|
|
|
|
If you are creating a new project and not maintaining an old project then i suggest you move on from VB6 to VB.net.
Have you stepped through the code in the debugger?
Sounds like AdoAudit or AdoRec isn't actualy set to any object.
After these object are declared there is usually a Set xyz = somewhere later on.
Try debug, and also look to make sure your objects are referencing correctly.
I also note your tim = now statement, Should this not be;
Dim tim as Date
tim = now()
|
|
|
|
|
Ace Anthony C. Austria wrote: However, whenever I run the program, it stops when I click cmdSave and Run-Time Error 91 "Object variable or With block variable not set". The highlighted syntax would be the five aforementioned lines involving AdoAudit. The save command for AdoRec, on the other hand, functions properly.
Is the AdoAudit object opened properly? If you're "just" adding records, then you could consider using a ADODB.Command with an INSERT -statement.I are Troll
|
|
|
|
|
That particular error usually means that one of the object that you are referencing does not have an instance. I suggest placing a break point on the first line that your code has trouble. Then use the immediate pane to check that each of your objects has an instance such as "?AdoAudit is nothing", and then "?AdoAudit.Recordset is nothing", etc. It'll return true/false for each object that you do this with.
Here is a an example that accomplishes what you are looking to do in your cmdSave_Click event. Note: be sure to replace the Const values. Hopefully, this working model (I tested it on my computer) will help you identify where your code went off.
Private Sub cmdSave_Click()
'enter values for your scenario
Const connStr As String = "<replace with the connection string to connect to your Access DB>"
Const tableName As String = "<replace with the table name of the table you wish to save to>"
'vars
Dim dbConn As ADODB.Connection
Dim saveRec As ADODB.Recordset
'initialize & open connection to DB
Set dbConn = New ADODB.Connection
dbConn.Open connStr
'initialize & open recordset to table
Set saveRec = New ADODB.Recordset
saveRec.Open "SELECT TOP 0 * FROM [" & tableName & "]", dbConn, adOpenDynamic, adLockOptimistic
'create new record
saveRec.AddNew
'save data to new record
saveRec("Operation") = "Added or Altered Reference Material"
saveRec("DateDone") = Format(Now, "mm-dd-yyyy")
saveRec("TimeDone") = Format(Now, "hh:mm:ss ampm")
'save record
saveRec.Update
'clean up
saveRec.Close
Set saveRec = Nothing
dbConn.Close
Set dbConn = Nothing
End Sub
|
|
|
|
|
Hi,
I am using Visual Basic 6.0. In My Application I had an treeview (listing file names) and an Webbrowser control. So that While choosing the filenames from the treeview it will be opened on the webbrowser. My Problem is that in Folder options-> File Types->Doc->Advanced->Browse in the same window is unchecked. So it opens Out side the web browser.
How to get this Settings.
so that if it is unchecked i can provide information to the User
Thanks
|
|
|
|
|
Those setting are buried in the registry.
You will need to write code that searches through the relevant hive and path to extract the setting for the relevant filetype.
(again, time to move on from VB6.....)
|
|
|
|
|
Please help me with my project hotel reservation system in visual basic programming language. Please, i really need the code coz i'm just a beginner in programming.., i really don't know how to program it.,
Thanks.., God Bless.,
|
|
|
|
|
Why would you accept a project if you know you can't do it, and what makes you think that some one else would do the work for you? My advice is free, and you may get what you paid for.
|
|
|
|
|
chazy_chaz640 wrote: Please help me with my project hotel reservation system in visual basic programming language. Please, i really need the code coz i'm just a beginner in programming.
May I suggest you start with 1) a book and 2) a simpler project. If you need someone else to write your project for you then please advertise in the Jobs forum.MVP 2010 - are they mad?
|
|
|
|
|
You just failed your class buddy, and rightfully so.
|
|
|
|
|
This assignment is too difficult for a beginner. I think the professor is crazy.
From the profile I see that this is probably from an American university. American universities have a reputation of having good quality. Maybe the professor wanted to keep the quality high and pushed the students too hard.
In our place we all take it easy. That's probably why we are not as advanced as the rest of the world.modified on Saturday, February 6, 2010 4:01 PM
|
|
|
|
|
Background:
I have a Visual Studio 2008 VB Windows application. The main window form can contain several MDI children. Each MDI child contains a progress bar to show the progress of actions which can take several minutes (the loading and parsing of large data files).
Question:
How I can have all of the progress bars from all of the MDI children continue to update even though only one of the MDI children is the active one?
Problem Description:
Say I start an action from within one MDI child (the loading and parsing a large file). The progress bar begins to slowly advance.
Say I then start an action from a different MDI child. The progress bar in that MDI child begins to slowly advance but the progress bar from the first MDI child no longer increments.
However, the action that I started from the first MDI child (the loading and parsing) does continue to run.
If I leave the second MDI child form and click on the first MDI child form, the progress bar of the first MDI child immediately jumps to where it should be but then the second MDI child's progress bar stops advancing (although the second MDI child's action continues to be performed).
Thank you for whatever suggestion you might have.
Jim
|
|
|
|
|
Can you show relevant code?
From what you describe, I would add a myProgressBar.Refresh() whenever myProgressBar.Value gets changed.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Have you tried using Application.DoEvents in your loops. Maybe not the best way to go, but it should ensure that forms get updated.
|
|
|
|
|
At a glance can anyone tell me why this might fire twice and move ahead two records some times, but not all the time?
Protected Overrides Function ProcessKeyPreview(ByRef m As System.Windows.Forms.Message) As Boolean
Select Case m.WParam.ToInt32()
Case 37
Me.DtRecordInfoBindingSource.MovePrevious()
Return True
Case 39
Me.DtRecordInfoBindingSource.MoveNext()
Return True
End Select
Return False
End Function
Any help would be appreciated.
|
|
|
|
|
Hi,
my guess is:
- your list Control (DataGridView or whatever) will process up/down keys if it has focus;
- your Form will preview and handle the same keys also.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. [The QA section does it automatically now, I hope we soon get it on regular forums as well]
|
|
|
|
|
Hello everyone,
I would like some opinions on good coding practices.
Below are 3 methods of writing a procedure.
Currently I am coding like method 3.
Any comments, please ?
Criteria: The function must return null if any errors occured.
'Method 1
'If byteIn is null the function will return nothing.
'This function uses two (2) returns.
'I read that using the return statements is perfered (I don't know why).
'The catch will fire if byteIn is nothing.
Public Function ByteArrayToStream(ByRef byteIn() As Byte) As System.IO.MemoryStream
Try
Return New System.IO.MemoryStream(byteIn, True)
Catch ex As Exception
Return Nothing
End Try
End Function
'Method 2
'If byteIn is null the function will return nothing.
'This function is assigning the result to the name of the procedure.
'The catch will fire if byteIn is nothing.
Public Function ByteArrayToStream(ByRef byteIn() As Byte) As System.IO.MemoryStream
Try
ByteArrayToStream = New System.IO.MemoryStream(byteIn, True)
Catch ex As Exception
ByteArrayToStream = Nothing
End Try
End Function
'Method 3
'If byteIn is null the function will return nothing.
'This function is checking for null so the catch does not have to fire.
'I read somewhere that it is better to pre-check for possible error conditions.
'This function uses only 1 return statement, better?
'I believe there is extra memory overhead (ms2) with this method.
Public Function ByteArrayToStream(ByRef byteIn() As Byte) As System.IO.MemoryStream
Dim ms2 As IO.MemoryStream = Nothing
Try
If byteIn Is Nothing Then Exit Try
ms2 = New System.IO.MemoryStream(byteIn, True)
Catch ex As Exception
ms2 = Nothing
End Try
Return ms2
End Function
|
|
|
|
|
Why not use Option #4 and wrap the Try\Catch in an If\Then\Else that checks the input parameter for a value and if it is nothing just returns?
modified on Friday, February 5, 2010 4:15 PM
|
|
|
|