|
|
|
Also the newrow statement falls over with "null reference" when I code the dataadapter but not when
I add in a dataadapter from the wizard. So what should the sql be here ? or the command so that I can creat a new row ?
Dim strConn As String = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\VilliageDatabase\Ainslie.mdb"<br />
Dim conn As New OleDbConnection(strConn)<br />
Dim Sql As String = "select * from tblTransaction"<br />
Dim adapter As OleDbDataAdapter<br />
adapter = New OleDbDataAdapter(Sql, conn)<br />
Dim ds As New DataSet<br />
Dim intc As Integer<br />
Dim str As String<br />
intc = adapter.Fill(ds)<br />
' str = ds.Tables(0).Rows(0).Item(4)<br />
Me.Text = str<br />
<br />
<br />
Dim newrow As DataRow = ds.Tables("tblTransaction").NewRow
Please if you can help ?
ml
-- modified at 5:24 Thursday 27th July, 2006
|
|
|
|
|
You didn't tell the DataSet what the name of the tables are. Try: ds.Tables(0).NewRow
|
|
|
|
|
HI.
from the flow of the code I assume you want to fill a datatable and then create a new row from it.
you can directly fill a datatable without using a dataset. Here I replaced some of the code.
With this method, you have a direct access to the dattable.
Dim strConn As String = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\VilliageDatabase\Ainslie.mdb"<br />
Dim conn As New OleDbConnection(strConn)<br />
Dim Sql As String = "select * from tblTransaction"<br />
<br />
<big>Dim TblTrans as new datatable</big><br />
<br />
Dim adapter As OleDbDataAdapter<br />
adapter = New OleDbDataAdapter(Sql, conn)<br />
<br />
conn.open()<br />
<br />
intc = adapter.Fill(<big>TBLtrans</big>)<br />
<br />
Dim newrow As DataRow = <big>TBLtrans.NewRow</big>
furthermore, you can filter the datatable using its defaultview without using an extra dataview.
TblTrans.DefaultView.RowStateFilter=DataViewRowState.Added <br />
Datagrid1.datasource = TBLtrans.defaultview
GUERVEN
Truth or Consequence
|
|
|
|
|
Hi guys,
i'm going to implement one windows project in VB.net,
actually i'm new to vb.net, i decided to use advance controls in vb.net which should more user friendly
could any one tell me about the advanced controls in vb.net 2003
|
|
|
|
|
I have a unbounded grid and 1 of the column...columns style is combobox binded to a table.
I want to handle the selectedvalue change event of the combobox.
How it can be done easily
Please help as i am relatively new to .Net
Thanx
Riyaz Zujer Patanwala
I.T.Programmer
Al Jaber Energy Services
P.O.Box 47467
Abu Dhabi
U.A.E.
|
|
|
|
|
I am looking quite a while to find the source code for copying an entire folder + contents to a target folder.
Can anyone help me?
Because if i dont have that code, the program im working on can't be finished.
Thanks, Zaegra
--Zaegra--
|
|
|
|
|
From MSDN (http://msdn.microsoft.com)
The following example determines whether a specified directory exists, deletes it if it does, and creates it if it does not. This example then moves the directory, creates a file in the directory, and counts the files in the directory.
[Visual Basic]
Imports System
Imports System.IO
Public Class Test
Public Shared Sub Main()
'Specify the directories you want to manipulate.
Dim path As String = "c:\MyDir"
Dim target As String = "c:\TestDir"
Try
' Determine whethers the directory exists.
If Directory.Exists(path) = False Then
' Create the directory.
Directory.CreateDirectory(path)
End If
If Directory.Exists(target) Then
' Delete the target to ensure it is not there.
Directory.Delete(target, True)
End If
' Move the directory.
Directory.Move(path, target)
'Create a file in the directory.
File.CreateText(target + "\myfile.txt")
'Count the files in the target.
Console.WriteLine("The number of files in {0} is {1}", _
target, Directory.GetFiles(target).Length)
Catch e As Exception
Console.WriteLine("The process failed: {0}", e.ToString())
End Try
End Sub
|
|
|
|
|
Im reading data from a PIC Micro-controller that is sent to the PC via RS232. I read a voltage with the micro, that is returned as a two byte value. The bytes are sent to the PC LSb first, so I need to 'flip' the byte around. Eg: 1011000 I needs to be converted to 0001101. I need to then concatenate the two bytes after they have been reversed, and use this value in a calculation.
At the moment, I receive the data as two bytes, convert them to binary strings (Convert.tostring(byte, 2)), use a for loop to reverse the order of each string byte, concatenate them, and then convert that back to a double to do my calculation
Is there an easier way of doing this?
|
|
|
|
|
Yep - string reverse function.
Assuming you have the string in a label...
'reverse the string in Label1
Label2.Text = StrReverse(Label1.Text)
Simple as. Nifty eh?
|
|
|
|
|
|
Hey,
Using message boxes in my vb.net application...
But when I test it, some of those MsgBoxs won't appear on top...
They will just appear on taskbar and application keeps focus...
Does anyone know a way to make sure the MsgBox appears on top,
and blocks application until a button is clicked?
Thanks in advance...
NNM
|
|
|
|
|
Has the form that calls the message box been instantiated with ShowDialog?
|
|
|
|
|
No...
One simple example of how I use it:
(sub)
(...)
If password1.Text <> password2.Text Then 'alert and stop operation:
MsgBox("The passwords in the two password fields do not match", 0, "Error")
(...)
(exit sub)
|
|
|
|
|
i'm using VB6, i wonder how to link my DBF file in my system. I want to edit and add some information by using VB6.
|
|
|
|
|
|
of course. but no solution.
Pls post here if u found one.
|
|
|
|
|
campbells wrote: of course. but no solution.
I've never worked with DBF but connectionstrings.com[^] has stuff for connecting to .dbf. Not sure if it's what you're looking for.
That's no moon, it's a space station. - Obi-wan Kenobi
|
|
|
|
|
what exactly is this DBF file.
is this the one that comes with a shape file? or a foxpro db?
GUERVEN
Truth or Consequence
|
|
|
|
|
Guerven wrote: what exactly is this DBF file
I'm not 100%. I am thinking campbells might be meaning a DBase file.
Paul
That's no moon, it's a space station. - Obi-wan Kenobi
|
|
|
|
|
Yes it's a dBase file or a foxpro file. I need to get this information as well, but don't want to use classes if possible.
steve Smith
|
|
|
|
|
Hello everybody,
We are planning to work on a project. The client side will be created with VB.net. This VB.net will call the backend of c code. I did the similar thing with php to call the backend of c code. The bridge between the php and c code was created with php extension for wrapping c code. Could you give a suggestion what kind of bridge will be created between VB.net and c code?
Thank you very much for your any suggestion
Jane
|
|
|
|
|
VB.NET can talk to managed C++, or c or C++ that is in a dll. COM is another option, but managed code is a far better one.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thank you very much for your information. Could you tell me where I can find this kind of code example?
Jane
|
|
|
|