|
After i put in true inside the bracket and run the program, it show me the message "the process cannot access the file because it is being used by another process.
|
|
|
|
|
That means the file is in use somewheres...
BTW, why do you want to overwrite the file? I was under the impression you want to create a new file and copy contents of another file to it?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
After i copy the file to the new file, i want to append the content again.
|
|
|
|
|
Okay, are you making sure the new file is closed before doing the appending?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
I have a dataset bound to a textbox. I'm using my own stored procs for the dataadapter. The data loads into the textbox, I can edit it and the changes show in the dataset. I am faced with 2 problems:
1. The dataset.haschanges = false. Even though I can see the changes when I access the dataset field in the immediate window.
2. The updatecommand parameter values in the dataadapter are null.
There are no errors. Everything runs, it just doesn't commit the changes to the database.
I can verify that the stored procs work fine. In fact if I put a DataGridView on the form and bind to that everything saves just fine, using the exact same code (apart from binding obviously) and stored procs.
Some code:
Table name: tblScripts
Column name: Script_Desc
Binding the textbox:
TextBox1.DataBindings.Add(New Binding("Text", m_ds, "tblScripts.Script_Desc"))
Update code:
If m_ds.HasChanges() Then
'if i skip into here there are no errors
'but changes do not commit to database
m_da.Update(m_ds, "tblScripts")
End If
Is there something special I need to do when binding a textbox to a dataset which was filled by a dataadapter which uses stored procs?
I'm using Vista with the Visual Studio 2005 Vista patch, is there a known bug by any chance?
Please help, I'm at my wits end!
|
|
|
|
|
Hi,
I am not sure about the rest of your code, but to bind a datasource to a control using simple binding (bind a control to one field) you need to specidy three issues:
-Property Name (e.g. Text)
-DataSource (e.g. DataTable)
-ColumnName
TextBox1.DataBindings.Add("Text", m_ds.DataTable, "ColumnName"))
Note: To apply the changes you need to change the cursor (move fwrd/bkwrd) or call the EndEdit of datarow object.
In addition, I see that you are checking the changes on the DS level, do you have one table only!!?
Also, check the where clause in the update scripts of the Update/Delete Commands of DataAdapter.
hope this helps
|
|
|
|
|
Thank you so much! Calling the EndEdit fixed it for me
|
|
|
|
|
i have an vc++ project i want to embed in vb.net how we can do this
any tutorials or examples
thank u
sree
|
|
|
|
|
I assume you are talking about managed vc++, if so, you'll need to take the code you want to embed, make a class library (.dll) out of it and reference the class library in the vb project...
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi
For example :
Class Parent<br />
Private Class Child<br />
Inherits System.Windows.Forms.UserControl<br />
End Class<br />
End Class
VS designer doesn't work with class Child
Is there anyway to load designer for Child ?
|
|
|
|
|
No, I don't think so. Why would you want to embedd a user control class ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I need it is Private , Child is used by Parent only
|
|
|
|
|
The designer will not look for classes embedded in other classes.
You also cannot do what you want, because the designer can't get at the private class to create an instance of it. Your UserControl class must be made Pblic for it to work in the designer. You can try breaking it out into a seperate class (both of your classes in the same file) and tagging it a Friend, but I have my doubts on it working. This is because a Friend class is visible only to other code in the same assembly, not outside the assembly. I'm guessing this would preclude the designer from seeing the class.
|
|
|
|
|
Thank you very much , i have never known that "the designer can't get at the private class to create an instance of it"
Actually , i want child class can use private fields and methods of parent class
|
|
|
|
|
hi all
how can i convert c# code into vb.net 2005 code using vb.net 2005
is someone have any link ?
|
|
|
|
|
There are free converters on the web, a couple of articles on this site about doing it, and commercial converters also available.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: free converters on the web
What is the general quality of the converters that are free on the web?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
They're getting better, but they are just not practical for some uses:
- project conversions (these require reflecting on referenced assemblies for accurate conversion - this is never done by online converters).
- ASP.NET inline code (this requires an extra parsing step that is not performed by online converters).
- Allowing different conversion options, such as array specifier placement (online converter offer no such options).
- Some snippet conversion referencing certain .NET system types (these sometimes require reflection on common .NET system assemblies for a proper conversion).
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
C++ to VB Converter: converts C++ to VB
Instant C++: converts C# to C++/CLI and VB to C++/CLI
|
|
|
|
|
Cool, thanks for the info
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
|
|
The online converters can be useful, but they are not very accurate (there's no commercial incentive for them to keep them up to date, for instance). The commercial converters will have free demo or trial editions that will convert limited length snippets, but much more accurately than online converters.
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
C++ to VB Converter: converts C++ to VB
Instant C++: converts C# to C++/CLI and VB to C++/CLI
|
|
|
|
|
Hi I get the exception "Object not set to an instance of an object when the code below is run.
Private Sub Bt_OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt_OK.Click
Me.ListBox1.Items.Clear()
Dim DBConn As OdbcConnection
Dim i As Integer
Dim AD As OdbcDataAdapter
For i = 0 To CarsNamesLBox.Items.Count - 1
If CarsNamesLBX.Items(i).Selected Then
DBConn = New OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=myServer;Database=CarCompaniesDB;User=myUser;Password=mypass;Option=3;")
AD = New OdbcDataAdapter("SELECT CarID, Model From CarsTB where Make = 'CarsNamesLBox.Items(i).Text'", DBConn)
End If
Next
If Not IsNothing(DBConn) Then
DBConn.Open()
Dim DT As New DataTable
AD.Fill(DT)
AD.Dispose()
Me.ListBox1.DataSource = DT
Me.ListBox1.DataTextField = "Model"
Me.ListBox1.DataValueField = "CarID"
End If
End Sub
The same exception was thrown when DBConn is empty, thus I used the If not IsNothing clause in the 2nd If statement to determine if that is the case. I thought I had solved that problem so now I don't know what could be causing this . The following is the source error that visual studio outputs .
Source Error:
Line 52: Dim AD As OdbcDataAdapter
Line 53: For i = 0 To CarsNamesLBox.Items.Count - 1
Line 54: If CarsNamesLBX.Items(i).Selected Then
Line 55: DBConn = New OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=myServer;Database=CarCompaniesDB;User=myUser;Password=mypass;Option=3;")
Line 56: AD = New OdbcDataAdapter("SELECT CarID, Model From CarsTB where Make = 'CarsNamesLBox.Items(i).Text'", DBConn)
Please help me resolve this, thank you in advance for your help.
-- modified at 1:48 Saturday 28th July, 2007
|
|
|
|
|
One would have to assume that CarsNameLBox, or CarsNamesLBox.Items is Nothing. There is a SelectedItem property, you can just use that ( be sure to check if it's Nothing first )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Why are you instantiating inside the For loop? You shouldn't be instantiating DBConn everytime you cycle through the loop.
ASPnoob wrote: AD = New OdbcDataAdapter("SELECT CarID, Model From CarsTB where Make = 'CarsNamesLBox.Items(i).Text'", DBConn)
You have an error in your select statement, Make is not going to be whatever CarsNamesBox.Items[i].Text , but the actual string CarsNamesBox.Items[i].Text
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|