|
Hallo,
I have a problem in VB.Net, i cant send data from my Linked list nodes to a data base. Also help on collecting information from text boxes to a node and displaying it to a Display box like a lebel.
-- modified at 3:59 Wednesday 3rd May, 2006
|
|
|
|
|
Below is the code which i am using to get a list of all the services on a system. The problematic part is that it works fine when i run it on local system when but when i try to list services on a remote system after passing the userid and password it gives me "Access Denied" error.
Do any one know how to get over this.
Overloads Public Shared Function Main(args() As String) As Integer
Dim query As ManagementObjectSearcher
Dim queryCollection As ManagementObjectCollection = Nothing
Dim oq As System.Management.ObjectQuery
Dim strComputerName As String
Dim strQuery As String = "SELECT * FROM Win32_Service"
'Do
'Console.Write("Please enter server name (type 'localhost' for local machine): ")
' strComputerName = Console.ReadLine
'Loop While strComputerName = ""
Dim co As ConnectionOptions = New ConnectionOptions
'If strComputerName.Trim.Length = 0 Then
' Console.WriteLine("Must enter machine IP address or name.")
' Return
'End If
Dim ms As System.Management.ManagementScope = New System.Management.ManagementScope("\\10.10.10.23\root\cimv2", co)
oq = New System.Management.ObjectQuery(strQuery)
query = New ManagementObjectSearcher(ms, oq)
Try
ms.Connect()
queryCollection = query.Get
Catch e1 As Exception
'Console.WriteLine( "Error: " & e1)
End Try
ListView1.Columns.Add("Services", 500, HorizontalAlignment.Left)
For Each mo As ManagementObject In queryCollection
ListView1.Items.Add(mo("Name").ToString + " [" + mo("StartMode").ToString + "]")
Next
End Function
|
|
|
|
|
Go to Control panel and then services. and right click on the Left tree and click connect ot another computer and check does it fetch the services or not. if not then you dont have rights on that system.
Rizwan Bashir
|
|
|
|
|
Code was correct but i was passing wrong credentials.
|
|
|
|
|
hi
I want to check whether the given user exists & if so whether he has privileges(Registry & Write) in VB.can anybody provide the functions or links??
I am using VB 6.0
Thanx in advance
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
i want to auto restart my application.
please help me ????????????
|
|
|
|
|
before exiting write this
Shell(Application.StartupPath & "\" & AppDomain.CurrentDomain.FriendlyName.ToString)
This will launch your application again.
Rizwan Bashir
|
|
|
|
|
Does anyone know how to get a copy of an existing form (at design time) in same project?
I t tried copy & paste, but it shows an error message, when I load the copied form at the design time.
Failed to parse method ‘InitializeComponent’, The parser reported the following error ‘Error HRESULT E_FAIL has been returned from a call to a COM component.’ Please look in the Task List for potential errors.
In Vb.Net 2003 I can simply do it by adding a new form and coping & pasting ‘windows Form Designer Generated Code’ of the existing form.
But VB.Net 2005 I cannot do it.
I don’t know how
Thank You,
Regards,
Chatura Dilan
|
|
|
|
|
Hello!
Click on the form in the Solution Explorer of which you want to create a copy of. Then hit 'ctrl + c' and 'ctrl + v'. It will create a copy of the form with name 'Copy of FormName'.
regards
Mubashir
-- modified at 4:23 Wednesday 3rd May, 2006
|
|
|
|
|
Mubashir,
I did it your way, but it shows above error too.
Failed to parse method ‘InitializeComponent’, The parser reported the following error ‘Error HRESULT E_FAIL has been returned from a call to a COM component.’ Please look in the Task List for potential errors.
Regards,
Chatura Dilan
|
|
|
|
|
Dear Sir/Madam,
I am currently design an application using VB.Net as an interface and Microsfot SQL Server 2000 as a data store. Our clients want to apply the unicode with it.
For the display of Unicode in Khmer, my country language is fine. However, I face a problem with search.
For example when I search for a person name using the SQL statement at the querry as well as embeded code in VB.Net the return value is emply. I had double checked on the name and it's stored in the database.
Can someone out there help me with this?
Kind Regards,
Sithy
Sithy
|
|
|
|
|
What is the Datatype which you are using in SQL server ?
I worked with Unicode and use the NVarchar in SQL . and while searching like a table with names I shall pass this query with using "N" keyword
Select * from TableName where Name = N'Name in your Language'
other wise if you are using varchar then you must have to define default language while creating the database.
So this will return me the answer.
Regards
Rizwan Bashir
|
|
|
|
|
Thank you sir for your help. The data type is Nvarchar. At first we created it as varchar but we've changed to NvarChar.
For example I want to search for a particular guy called Sithy from the table called TName, and the attribute is FullName i would write:
Select FullName from TName where FullName = N'Sithy'
Is the statement correct?
Thank again
Sithy
|
|
|
|
|
yes the statement is correct . and since it is not searching. open the SQL server and check in table the record is readable or not. if not then remember that during insertion it should go this way
insert into Tname(FullName)Values(N'Sithy')
this will insert the data properly and then try to fetch and I am sure it will work. as my all the applications are multi-lingual and working 100% on this criteria.
Rizwan Bashir
|
|
|
|
|
thank you sir for the reply.
Will it works for insertion of variable rather than constant like this?
Regards,
Sithy
|
|
|
|
|
yes it will work . like
' txtName is the textbox and the code is
insert into Tname(FullName)Values(N'" & txtName.text & "')
Do let me know your problem is solved or not. also tell me the regional language on which you are working ? ( Just for information )
Regards
Rizwan Bashir
|
|
|
|
|
thank you for your help
The original language is Khmer (a Cambodian language)
By the way, do you know how to split windows with data grid in VB.Net. I am encountered problem with that. My clients want to have the ability of splitting windows such as the Excel application where we can fix the column heading and row heading
Regards,
Sithy
|
|
|
|
|
I dont know about the MS grid if it do this or not. but there is a infragistic grid control which do this.
Rizwan Bashir
|
|
|
|
|
Dear Sir,
Thank you very much for your help. By the way, does infragistic grid control work with VB.Net. If you don't mind, please help me with this and show how to work with it.
Kind regards,
Sithy
|
|
|
|
|
thank it works now.
Regards
Sithy
|
|
|
|
|
Dear ALL,
I have encounter problem when I deleting a record in my program. Error msg as follow:
OleDbException was unhandled.
No value given for one or more required parameters.
I think I have declare the correct statement but it still prompt me...
My code as follow:
Public Sub delRec(ByVal column As String, ByVal table As String, ByVal value As String)
'create connection instance with connection string
Dim myConnection As New OleDbConnection(ConnString)
'sql delete query
Dim query As String
If table = "SALPASS" Then
query = "DELETE FROM " & table & " where " + column + " = " + value
Else
query = "DELETE FROM " & table & " where " & column & " = " & value
End If
'create sql command instance with the delete query
Dim myCommand As New OleDbCommand(query, myConnection)
'open database connection
myConnection.Open()
'execute sql delete command found in query string
myCommand.ExecuteNonQuery()
'Close the connection
myConnection.Close()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If GroupBox1.Text = "Sales" Then
If TextBox1.Text = "" Then
'display error message box
MsgBox("Error!" + vbCrLf + vbCrLf + "Please select User Id to delete", MsgBoxStyle.Exclamation, "Deletion Error")
Else
'deletes record from database
delRec("USER_ID", "SALPASS", TextBox1.Text)
lblLabel.Text = "Record Deleted"
'refresh table
getsaltable()
End If
end sub
I just want to delete the user id and password.
Please advise.
Thanks
Jack
Jack
|
|
|
|
|
Do one thing. the query you build in the function. Copy that Query and run that directly in the SQL Query analyzer or what ever the database you are using. this will clear you that the query is fine.
Also check on which line it creates the problem ?
|
|
|
|
|
ur query i think is somewhat wrong. It should be
query="DELETE FROM '"& table &"' where '" + column + "' = '" + value+"'
format should be
<string_variable>="<insert,update,delete> from '"+<table_name>+"' "
all runtime values should be entered inthis format
'"+<variable_name or="" parameter_name="">+"'
if + sign doesn't work try &
|
|
|
|
|
Thanks Will try on that
jack
|
|
|
|
|
i would like to view record from the dataabse.but i dont know how to write the coding..sir,pls help me.
|
|
|
|