|
|
Dear all,
I'm new to VB.NET,I have this error:
System.Data: Value cannot be null.
Parameter name: dataSet
I want to display the data search result into the datagridview for the user. But I found the above error. The following is my code,the user click button1(which is the search button),then it will search from the database. The message box I'm here have pop out like usual. Anyone can tell me whats wrong with it?
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As String
Try
If Trim(TextBox2.Text) <> "" Then
x = TextBox2.Text.ToUpper
SQL = "SELECT * FROM company_detail WHERE Comp_Name LIKE '" & x & "%'"
ObjComm = New MySqlCommand(SQL, ObjMyConn)
ObjMyConn.Open()
ObjRead = ObjComm.ExecuteReader
If ObjRead.Read Then
MessageBox.Show("I'm here")
ObjAdapter = New MySqlDataAdapter(SQL, ObjMyConn)
ObjAdapter.Fill(ds, "Client_Comp")
dt = ds.Tables("Client_Comp")
DataGridView1.DataSource = dt
End If
End If
ObjMyConn.Close()
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly)
End Try
End Sub
Thank you for reading.
|
|
|
|
|
Have you tried to omit the filter of the select-statement?
Changing this line:
SQL = "SELECT * FROM company_detail WHERE Comp_Name LIKE '" & x & "%'"
To this:
SQL = "SELECT * FROM company_detail"
Does this have rows?
I are troll
|
|
|
|
|
You didn't specify which line the error occurs on, but I can take an educated guess:
ObjAdapter.Fill(ds, "Client_Comp")
Your DataSet object, ds , is Nothing , or null in C#. You have to create an instance of a DataSet object to pass to the DataAdapter.
|
|
|
|
|
How should i configure a console application to be independent from .NET Framework? Can i copy all the assemblies which it references to a CD with the application itself and run it then on a computer where .NET framework isn't installed?
This is my program:
Module Module1
Public Declare Function HideConsole Lib "kernel32.dll" Alias "FreeConsole" () As Integer
Sub Main()
HideConsole()
Dim s As String
Dim procID As Integer
If My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\Subroutine\ENERGOMONT", _
"Installed", 1000) = "Yes" Then
s = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\SOFTWARE\Subroutine\ENERGOMONT", _
"Path", 2000) & "Energomont.exe"
procID = Shell(s, AppWinStyle.NormalFocus)
Else
procID = Shell("setup.exe", AppWinStyle.NormalFocus)
End If
End Sub
End Module
It referenced only Microsoft.VisualBasic namespace in system.dll, so i copied it on the cd. That is because of shell command and appwinstyle command, but how come that "My" keyword doesn't produce any references? I found out that it requires system.win32.registry reference. Why doesn't it appear with the references list?
modified on Tuesday, January 20, 2009 5:39 AM
|
|
|
|
|
If you have written your program in a .NET language, you need to install the relivent version of the .NET Framework.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|
|
So, are you saying what i suggested can not be done?
|
|
|
|
|
Correct, what you are attempting cannot be done!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
stardust1611 wrote: How should i configure a console application to be independent from .NET Framework
Write it in C++, that's what I do.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
..or anything else that can compile native code. My personal preference lies with Delphi 6.
Any which way, you don't need a full integrated development environment for a simple console-application. There are quite some compilers out there[^] that are free.
I are troll
|
|
|
|
|
Hi all...
I have searched a lot on Google but i did not find my answer.
I have used a WebBrowser control in my application to create a new web browser.I only want to store the selected text of body of webbrowser control in a string as the same can be done with a text box as follows :
str=textbox1.selectedtext suggest me how can I do it with webbrowser control.
Thanks.
Gagan
|
|
|
|
|
There is no equivilent in the WebBrowser control. It does not expose any kind of SelectedText properties like the textbox does. I know of no way to get the text you want.
|
|
|
|
|
This is the article which i found on cp about serial communication. I know it is quite simple if i am communicating between 2 computers but what if i am communicating with a hardware instead of computer? I have been told that it is the same between communication with computer or hardware but i just dun quite understand the concept. Current i have part of the code in my server pc and the other part i do not know how to apply. I dun seem to be able to open the port and send command to my hardware. Have anyone done a similar project and please advise me what to do?
http://www.codeproject.com/KB/system/Serialport_COM.aspx[^][^]
modified on Monday, January 19, 2009 8:24 PM
|
|
|
|
|
You've been told before. There is NO DIFFERENCE between talking to another computer and talking to a hardware device when communicating over a serial port.
If you know how it works talking to another computer, the EXACT same concepts apply when talking to hardware.
Subjugate wrote: I dun seem to be able to open the port and send command to my hardware.
Then it would appear that you don't have the communication paraters correct, like baud rate, stop bits, parity, handshaking, ...
|
|
|
|
|
Yes..,
There is no difference between taking to another computer and taking to a hardware device.
Checkout the settings(buadrate,parity,flow control....) of your hardware device, is responding..., then only u can get correct response for your command...
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
So...why are you telling me this and not the OP? I already know how it works.
|
|
|
|
|
I did already done the confirmation of the setting but still no reaction from my hardware. As i saw in the article i found on cp, there is another set of code suppose to be at the other pc so i wonder where should tis set of code be at if it is for hardware. Cant possibly put the code in a hardware.
|
|
|
|
|
The other "set of code" on the other PC is there so there's something that listens to it's serial port and can respond to requests comming from it. This is already built into the device you're trying to talk to! Seriously, how long have you been using computers??
|
|
|
|
|
Sorry for being so noob. Thanks anyway i got my command line to my hardware already. But the question now is i was unable to see the reply. How can i get the reply to be posted at a list box? Which means i need to display the reply from the port to list box.
|
|
|
|
|
SALAM SIR;
how can made notepad application in vb6?please send me full coding of notepad application in vb6.
THANKS SIR
mohammedali
|
|
|
|
|
SH*T man, When are you going to stop? You need a messenger, then you need this, then you ask for books, then you come back to this.
NO ONE IS GOING TO GIVE YOU CODE
|
|
|
|
|
STOP bothering us for an entire project just because you are either too lazy, too stupid or some combination of the two to do your own work.
NO ONE HERE IS GOING TO GIVE YOU AN ENTIRE PROJECT.
Have you not figure this out yet?
Apparently not since you keep posting idiot questions like this.
CONGRATS! You are a complete idiot! There's you f***ing code.
"Well, we're getting "F"'d at work. WPF, WCF, and WWF... WTF?" --John Simmons
|
|
|
|
|
The worst part is how many notepad vb6 clones exist, with full source included that this guy can't f***ing use google.
Honestly. GOOGLE, it would have given him this and his stupid messenger already.
|
|
|
|
|
leckey wrote: CONGRATS! You are a complete idiot! There's you f***ing code.
Best 1-liner of the month. hahahaha.
Any suggestions, ideas, or 'constructive criticism' are always welcome.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Some advice :-
1) Do not be developing in VB6, it's a dead/dying language.
2) If you can write a simple Notepad program, then maybe you should consider a different career.
Steve Jowett
-------------------------
Real programmers don't comment their code. If it was hard to write, it should be hard to read.
|
|
|
|