|
Thanx but, I solve my problem with arguments!
|
|
|
|
|
Hello,
Can anyone help me to update the database using the values in textboxes. I have successfully written code to add new rows and to delete rows in the database by checking the values in the textboxes on the form. But my problem is that I am unable to update the database similarly.
I have created a table in MS-Access named "emp" containing two fields named "name" and "phone" with phone as primary key.
On the form I have made two textboxes with their DataBinding text property set for name and phone fields respectively of the dataset.
Also I have made a button to load the dataset. And yet another button on which I want to code for updating the database.
I have tried many codes but none of them works, when I load the dataset and then make some changes in the text of the textboxes and then click on the update button the respctive database is not updated.
If anyone has answer to this problem please inform me with code, this is very urgent and I m facing this problem for many days .
|
|
|
|
|
here is simple update command
Update emp set name = '" & Textbox1.Text & "' and phone='" & TextBox2.Text & "'"
|
|
|
|
|
Hi!Mohit Namdeo.
All steps right but not enough. When you input on textboxs then datas only update on dataset no update on database. so you must do that.
here code on button update
be sure the connection,dataset,oledb...are created.
private sub update_click(...)
{
oledb.update(dataset)
}
end sub
good luck
|
|
|
|
|
I use vb.net for in-house development of apps. Many of these apps are small in size, with few if any referenced dlls. I'd like my apps to be *totally* self-contained--that is, I want to be able to drag and drop the contents of the app's directory onto a new machine and have it run *with no installation procedures*.
In the past (vb.net 2003) this seemed relatively reliable, assuming that the dotnet framework was in place and that any referenced dlls or third-party components had their CopyLocal property set to TRUE. Since switching to vb.net 2006, this does not always seem to be the case. Apps that I have ported from 2003 to 2006, fail to run with errors like "The app encountered a problem....blah blah send a report to microsoft".
This does *not* mean that I require an app to be a single exe file--only that *everything* required for the app is contained within a single folder that can be moved from machine to machine.
Is there a 100% accurate manner of making an app totally self-contained in that it will run on a machine with the (proper) dotnet framework installed? If not, is there a manner in which a more accurate error report can be generated on a (non-developer) machine with a bit more useful information--such as exactly what is missing?
|
|
|
|
|
First, an app compiled on .NET Framework 2.0 CAN work on an older version of the Framework. BUT!!! Only if the app doesn't use functionality specific to the 2.0 version.
So, if your client machines have the 1.1 version of the .NET Framework, they can still run the 2.0 compiled code, ... to a point. This is probably where your problem is comming in.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Dave,
I'm not sure what you're saying here....is what you are describing that my new vb.net 2005 application (which uses framework 2.0) is trying to run using framework 1.0 and failing? Even though both frameworks 1.0 and 2.0 are *both* installed on the machine?
Is it possible that I've compiled (in vb.net 2006) an app that is forcing itself to use the 1.0 framework by mistake? How would this be "deterred" if so?
|
|
|
|
|
Any app compiled under .NET 2.0 (VB.NET 2005) will run under 2.0 first, if it's available. If not, it'll use the highest version .NET Framework installed, if possible.
Using VB.NET 2005, there's no way you could possibly have compiled it under a 1.x .NET Framework by mistake. The compilers used by Visual Studio are not in Visual Studio, but are an integral part of the .NET Framework.
If your app crashed, does anything show up in the machines event logs (Application, Security, or System)??
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Ah. That makes sense...Since both frameworks are installed, it should be safe to assume that the correct version is being used.
No, nothing in the event logs (any of them). Just the before-mentioned error message/dialog.
Ideally, I'd like to be able to "self enclose" my in-house apps in a folder, then to installations by copying this folder to machines on our network. I've done this in the past with 2003, and even place folders of apps on a linux server that users on windows boxes can run from their desktops.
However, since switching to 2005 this seems a bit more unpredictable. There has to be a reliable method of guaranteeing that all references for an app are in a folder to be copied to to local machine *without* having to perform a full install. Someone on a newsgroup suggested ClickOnce, but this seems just as skittish, and only installs for the current user.
|
|
|
|
|
smarr wrote: There has to be a reliable method of guaranteeing that all references for an app are in a folder
No, there isn't. Not all dependencies can be reliably traced by code and some dependencies are just assumed to be available on target machines. There are just too many different ways you can call code, both managed and unmanaged, that reside outside of the assemblies of your app.
You have to test your distributions before you roll them out to the masses. I like to distribute Debug code to a couple of test machines (VMWare or Virtual PC comes in real handy for this!) to make sure it works before I retest it again using Release versions. This does a pretty good job of catching those natsty little errors your seeing on your client machines.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Correct me if I'm wrong here, but wasn't one of the tenets of DotNet that--because dlls and "called components" could all be contained within an app's installation folder--that it cured DLL hell-type issues like this?
If the installer gets the information on what to install from the app itself, and the installer works but copying all the listed references does not, then by association the installer is doing something *extra* that it is not being told by the app (or at least, the info isn't visible to the user). There has to be a manner of seeing this info so that I can manually copy those file independently and make sure they are there. Perhaps an app that can detect what refs are being called during an app's execution.....
|
|
|
|
|
I can't figure out how to use the the system.drawing.font to set multple properties of a fontstyle. For example:
Dim vbFont3 As New System.Drawing.Font("Century Schoolbook", 12, FontStyle.Bold)
I would like to also be Italic.
Anybody know how to do this?
Jerry Hogan
|
|
|
|
|
FontStyle is has a FlagsAttribute. This means that you can combine them using bit-wise operations, like And and Or, like this:
Dim vbFont3 As New Font("Century Schoolbook", 12, FontStyle.Bold Or FontStyle.Italic)
This will create a new Font that is both Bold AND Italic, despite the Or operator in there. Remember, it's a bit-wise OR. Not one or the other.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave,
U the Man
|
|
|
|
|
hi
Dim DR As OdbcDataReader
Dim ConnStr As String = "Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=AgentImg;uid=root;pwd=;option=3"
Dim con As OdbcConnection = New OdbcConnection(ConnStr)
Dim ad As OdbcDataAdapter = New OdbcDataAdapter()
Dim strCommand As String = "Select * from login where UserName= '" & Trim(TextBox1.Text) & "' And Password= ' " & Trim(TextBox2.Text) & "' "
Dim InsCom As OdbcCommand = New OdbcCommand(strCommand, con)
con.Open()
ERROR DR = InsCom.ExecuteReader()
If (DR.HasRows) Then
MsgBox("welcome")
Else
MsgBox("Wrong Information")
End If
con.Close()
End Sub
actually i'm using mysql for this i'm using ODBC.
I declare
Dim DR As OdbcDataReader.
but when i tried
DR = InsCom.ExecuteNonQuery()
Value of type 'Integer' cannot be converted to 'System.Data.Odbc.OdbcDataReader'.
WHAT IS THE PROBLEM
|
|
|
|
|
Are you really sure that this is the actual code that gives that error message?
The ExecuteReader method returns an OdbcDataReader object, so it shouldn't produce that error message. From the error message it looks more like you are using the ExecuteNonQuery method instead.
---
b { font-weight: normal; }
|
|
|
|
|
hi yes u have great knowledg there is no doubt abt it.
im making a project could u help me.
i want ur guidance.......
i hope u will....
i have to make a CategoryMaster form in which every cateory have a Image.
& this point is confusing me.
how i will display the image dynmically...& in which control.....
because i have to display these images in 4* 4 matrix.
please give some suggestion.
|
|
|
|
|
Hello,
I realy like the program the MahendranG made (HostName, IP And MAC Address). The only problem is that I don't know anything about C# and little about VB.NET... the program is in C#. Anyway, I worked on the converion from C# to VB.NET but having some problems. When I run the program and click the Display button I get the following message...
Error: Arithmetic operation resulted in an overflow.
I click the OK button and the program closes. Now, I also get one warnings; Public Property Address() As Long' is obsolete: 'This property has been deprecated. It is address family dependent. Please use IPAddress.Equals method to perform comparisons. But if I change it I get a hole pack of errors. Can anyone please help me with this?
Improts
<br />
Imports Microsoft.VisualBasic<br />
Imports System<br />
Imports System.Drawing<br />
Imports System.Collections<br />
Imports System.ComponentModel<br />
Imports System.Windows.Forms<br />
Imports System.Data<br />
Imports System.Net<br />
Imports System.DirectoryServices<br />
Imports System.Runtime.InteropServices<br />
C#
<br />
private void ButDisplay_Click(object sender, System.EventArgs e)<br />
{<br />
try<br />
{<br />
<br />
this.Status.Text = "Collecting Information...";<br />
<br />
if(this.TxtWorkGroup.Text.Trim() == "")<br />
{<br />
MessageBox.Show("The Work Group name Should Not be Empty");<br />
return;<br />
}<br />
<br />
<br />
DirectoryEntry DomainEntry = new DirectoryEntry("WinNT://" + this.TxtWorkGroup.Text.Trim());<br />
DomainEntry.Children.SchemaFilter.Add("computer");<br />
<br />
<br />
foreach(DirectoryEntry machine in DomainEntry.Children)<br />
{<br />
string[] Ipaddr = new string[3];<br />
Ipaddr[0] = machine.Name;<br />
<br />
System.Net.IPHostEntry Tempaddr = null;<br />
<br />
try<br />
{<br />
Tempaddr = (System.Net.IPHostEntry)Dns.GetHostByName(machine.Name);<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show("Unable to connect woth the system :" + machine.Name );<br />
continue;<br />
}<br />
System.Net.IPAddress[] TempAd = Tempaddr.AddressList;<br />
foreach(IPAddress TempA in TempAd)<br />
{<br />
Ipaddr[1] = TempA.ToString();<br />
<br />
byte[] ab = new byte[6];<br />
int len = ab.Length;<br />
<br />
int r = SendARP( (int) TempA.Address, 0, ab, ref len );<br />
string mac = BitConverter.ToString( ab, 0, 6 );<br />
<br />
Ipaddr[2] = mac;<br />
} <br />
<br />
System.Windows.Forms.ListViewItem TempItem = new ListViewItem(Ipaddr);<br />
<br />
this.ListHostIP.Items.Add(TempItem);<br />
}<br />
<br />
this.Status.Text = "Displayed";<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message,"Error",System.Windows.Forms.MessageBoxButtons.OK );<br />
Application.Exit();<br />
}<br />
<br />
}<br />
VB.NET Conversion
<br />
Private Sub ButDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButDisplay.Click<br />
Try<br />
<br />
Me.Status.Text = "Collecting Information..."<br />
<br />
If Me.TxtWorkGroup.Text.Trim() = "" Then<br />
MessageBox.Show("The Work Group name Should Not be Empty")<br />
Return<br />
End If<br />
<br />
<br />
' Use Your work Group WinNT://&&&&(Work Group Name)<br />
Dim DomainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" & Me.TxtWorkGroup.Text.Trim())<br />
DomainEntry.Children.SchemaFilter.Add("computer")<br />
<br />
<br />
' To Get all the System names And Display with the Ip Address<br />
For Each machine As DirectoryEntry In DomainEntry.Children<br />
'INSTANT VB NOTE: The local variable Ipaddr was renamed since Visual Basic will not uniquely identify class members when local variables have the same name:<br />
Dim Ipaddr_Renamed As String() = New String(2){}<br />
Ipaddr_Renamed(0) = machine.Name<br />
<br />
Dim Tempaddr As System.Net.IPHostEntry = Nothing<br />
<br />
Try<br />
Tempaddr = CType(Dns.GetHostEntry(machine.Name), System.Net.IPHostEntry)<br />
Catch ex As Exception<br />
MessageBox.Show("Unable to connect woth the system :" & machine.Name)<br />
Continue For<br />
End Try<br />
Dim TempAd As System.Net.IPAddress() = Tempaddr.AddressList<br />
For Each TempA As IPAddress In TempAd<br />
Ipaddr_Renamed(1) = TempA.ToString()<br />
<br />
Dim ab As Byte() = New Byte(5){}<br />
Dim len As Integer = ab.Length<br />
<br />
' This Function Used to Get The Physical Address<br />
Dim r As Integer = SendARP(CInt(TempA.Address), 0, ab, len)<br />
Dim mac As String = BitConverter.ToString(ab, 0, 6)<br />
<br />
Ipaddr_Renamed(2) = mac<br />
Next TempA<br />
<br />
Dim TempItem As System.Windows.Forms.ListViewItem = New ListViewItem(Ipaddr_Renamed)<br />
<br />
Me.ListHostIP.Items.Add(TempItem)<br />
Next machine<br />
<br />
Me.Status.Text = "Displayed"<br />
Catch ex As Exception<br />
MessageBox.Show(ex.Message,"Error",System.Windows.Forms.MessageBoxButtons.OK)<br />
Application.Exit()<br />
End Try<br />
<br />
End Sub<br />
|
|
|
|
|
Our Instant VB C# to VB.NET converter produces:
Private Sub ButDisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Try
Me.Status.Text = "Collecting Information..."
If Me.TxtWorkGroup.Text.Trim() = "" Then
MessageBox.Show("The Work Group name Should Not be Empty")
Return
End If
' Use Your work Group WinNT://&&&&(Work Group Name)
Dim DomainEntry As DirectoryEntry = New DirectoryEntry("WinNT://" & Me.TxtWorkGroup.Text.Trim())
DomainEntry.Children.SchemaFilter.Add("computer")
' To Get all the System names And Display with the Ip Address
For Each machine As DirectoryEntry In DomainEntry.Children
Dim Ipaddr As String() = New String(2){}
Ipaddr(0) = machine.Name
Dim Tempaddr As System.Net.IPHostEntry = Nothing
Try
Tempaddr = CType(Dns.GetHostByName(machine.Name), System.Net.IPHostEntry)
Catch ex As Exception
MessageBox.Show("Unable to connect woth the system :" & machine.Name)
Continue For
End Try
Dim TempAd As System.Net.IPAddress() = Tempaddr.AddressList
For Each TempA As IPAddress In TempAd
Ipaddr(1) = TempA.ToString()
Dim ab As Byte() = New Byte(5){}
Dim len As Integer = ab.Length
' This Function Used to Get The Physical Address
Dim r As Integer = SendARP(CInt(TempA.Address), 0, ab, len)
Dim mac As String = BitConverter.ToString(ab, 0, 6)
Ipaddr(2) = mac
Next TempA
Dim TempItem As System.Windows.Forms.ListViewItem = New ListViewItem(Ipaddr)
Me.ListHostIP.Items.Add(TempItem)
Next machine
Me.Status.Text = "Displayed"
Catch ex As Exception
MessageBox.Show(ex.Message,"Error",System.Windows.Forms.MessageBoxButtons.OK)
Application.Exit()
End Try
End Sub
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C# to C++ converter and VB to C++ converter
Instant J#: VB to J# converter
Clear VB: Cleans up VB.NET code
Clear C#: Cleans up C# code
|
|
|
|
|
hi im very new to vb,in my application i need to read the content of the excel file thro rows.i have tocheck whether the rows are left blank.thanks in advance.
and im using VB6.0
so please help me to get start my code
with regards,
susa
|
|
|
|
|
|
hi Everybody
i am working on window application in vb.net
actually i want to show my form under the visio window means to make visio as parent window for that form, how can i do that .
if anybody know please help me.
Thanks
|
|
|
|
|
You can't. You cannot make your application a child window of another application.
If you want to do something like this, you'll have to write an Add-On for Visio.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
yes i know that it can be done by using set paarent window but it is not working or i used in the wrong way if anyone of you know please help me
Thanks
-- modified at 6:47 Friday 7th April, 2006
|
|
|
|
|
Once again, NO, YOU CAN'T DO THIS!!
You can NOT make your window a child window of another application!
Why? Because when the other application repaints it's own window, your window will never get repainted. This is because your window is not going to get, and can NOT get, the WM_PAINT messages it needs to tell it to repaint at the appropriate time.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|