|
|
i am not able to get the data from this link
can you please give me another information
divya
-- modified at 5:01 Monday 26th June, 2006
|
|
|
|
|
please can you give another suggesionsor link
divya
-- modified at 6:37 Wednesday 28th June, 2006
|
|
|
|
|
The link that I provide will give you an article of using vb.net and sql server. You should learn how to get data from sql server and save its back to sql server. This is the basic that you need to do with data manipulation from vb.net. Once you get all of its technique to use it, you would be able to solve your currentl problem.
Best Regard,
Kanel
|
|
|
|
|
please help me in completing this module
i want to transfer the data from one database to another within the same server. But there is a problem of identity column that exist in the table and it will unable the code to transfer the data within the new database
my coding is
Dim ObjSrcConnection As System.Data.SqlClient.SqlConnection
Dim ObjDesConnection As System.Data.SqlClient.SqlConnection
Dim TableListConn As SqlConnection
Dim cmd As SqlCommand
Dim ObjSrcCommand As SqlCommand
Dim ObjDesCommand As SqlCommand
Dim da As SqlDataAdapter
Dim ds As New DataSet
Dim dr As SqlDataReader
Dim dt As New DataTable
Dim query As String
Dim TableName As String
Dim TableListConnString As String
Dim strConSrc As String
Dim strConDest As String
Dim string1 As String
Dim TableQuery As String
Dim strCol As String
Dim strType As String
Dim sqlQuery As String
Dim intJ As Integer
Dim intK As Integer
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGetTable.Click
Validation()
Table()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMigrate.Click
TableName = ListTable.Text
strConSrc = "server=" & txtSrcServer.Text.Trim & ";user id=" & txtUser.Text.Trim & ";password=" & txtPwd.Text.Trim & ";database=" & txtSrcDb.Text.Trim & ""
strConDest = "server=" & txtDesServer.Text.Trim & ";user id=" & txtDesUser.Text.Trim & ";pwd=" & txtDesPwd.Text.Trim & ";database=" & txtDesDb.Text.Trim & ""
ObjSrcConnection = New SqlConnection(strConSrc)
ObjSrcConnection.Open()
ObjDesConnection = New SqlConnection(strConDest)
'con2.ConnectionString = strConDest
ObjDesConnection.Open()
TableQuery = "select * from " & TableName
ObjSrcCommand = New SqlCommand(TableQuery, ObjSrcConnection)
dr = ObjSrcCommand.ExecuteReader(CommandBehavior.CloseConnection)
dt = dr.GetSchemaTable
Dim i As Integer = dt.Rows.Count
For intJ = 0 To i - 1
If intJ = 0 Then
strCol = dt.Rows(intJ).Item(0).ToString()
Else
strCol = strCol & "," & dt.Rows(intJ).Item(0).ToString()
End If
Next
If find1() = True Then
Exit Sub
End If
While dr.Read()
Try
'sqlQuery = "Insert into " & strValue & "(" & strCol & ") Values( " & Convert.ToString(dr.Item()) & "')"
sqlQuery = "Insert into " & TableName & "(" & strCol & ") Values( "
For intK = 0 To i - 1
If (intK = (i - 1)) Then
sqlQuery = sqlQuery & "'" & CStr(dr.Item(intK)) & "'"
Else
sqlQuery = sqlQuery & "'" & CStr(dr.Item(intK)) & "',"
End If
Next
sqlQuery = sqlQuery & ")"
ObjDesCommand = New SqlCommand(sqlQuery, ObjDesConnection)
ObjDesCommand.CommandType = CommandType.Text
Catch ex As Exception
MsgBox("Error in reading :" & ex.Message, MsgBoxStyle.DefaultButton1.Information, "Data Migration")
End Try
Try
ObjDesCommand.ExecuteNonQuery()
Catch ex As Exception
MsgBox("Error " & ex.Message, MsgBoxStyle.DefaultButton1.Information, "Data Migration")
Exit Sub
End Try
End While
ObjSrcConnection.Close()
ObjDesConnection.Close()
End Sub
Public Function Table()
Try
TableListConnString = "Server=" & txtSrcServer.Text.Trim & ";uid=" & txtUser.Text.Trim & ";pwd=" & txtPwd.Text.Trim & ";database=" & txtSrcDb.Text.Trim & ""
TableListConn = New SqlConnection(TableListConnString)
query = "select * from sysobjects where type='U'"
cmd = New SqlCommand(query, TableListConn)
TableListConn.Open()
Catch ex As Exception
MsgBox(" Entries are not correct :" & ex.Message, MsgBoxStyle.OKCancel.Information, "Data Migration")
Exit Function
End Try
da = New SqlDataAdapter(cmd)
da.Fill(ds)
ListTable.DataSource = ds.Tables(0).DefaultView
ListTable.DisplayMember = "name"
TableListConn.Close()
TableName = ListTable.Text
End Function
Public Function find1() As Boolean
Dim find2 As String
find2 = "Select name from syscolumns where id = object_id(" & TableName & ")and autoval is not NULL"
If Not (find2 Is Nothing) Then
MsgBox("There is an identity column in the table so we are not able to enter the data in table ", MsgBoxStyle.DefaultButton1.Information, "Data Migration")
Return True
End If
Exit Function
End Function
End Class
divya
|
|
|
|
|
SET indentity_insert YourTable ON
here goes insert
SET indentity_insert YourTable OFF
Robert
|
|
|
|
|
Hello,
I m using textbox to enter Phone no.
How can i restrict the maximum length to get data is 10.
Thanks in Advance
Regards
Mamathy
|
|
|
|
|
hi,
u textbox properties maximum length 10
in property window
bye
|
|
|
|
|
In button event
If not Textbox.Text.Length>10 Then
'Correct go here
Else
Msgbox("Phone to long"
End If
................
|
|
|
|
|
In button event
If not Textbox.Text.Length>10 Then
'Correct go here
Else
Msgbox("Phone to long")
End If
................
|
|
|
|
|
hi every body
i need a vb.net sample code to do the following.I connect a digital video camera(DVC) to my computer using USB which has some video files in it.i want a vb.net application to import the video files from the DVC and to save in to any specified directory i feed
the program works like as, user select a menu(ex import Video files).automattically the vb code detect the camera and read the video files and import it to some directory.
I searched the net for last one month time.every body are talking about WIA and TWAI dll to image acqistion.i dont want image acquistion.I cant undestand what does the TWAI do.so please some one help me using VB.net or C#.
god bless u
Thank you
Dumbo
|
|
|
|
|
I can't run my project in VS 2005 and the error message look like this...
Visual Studio cannot start debugging because the debug target 'C:\Projects\abc\Source\Rich Client\abcMain\bin\Release\abc.exe' is missing. Please build the project and retry, or set the OutputPath and AssemblyName properties appropriately to point at the correct location for the target assembly.
thanks
angela
|
|
|
|
|
What is the group member that your user account reside in when you log on to and run vs.net?
|
|
|
|
|
Did you means the group or user names for my project properties?
Administrators, creator owner, system and user...
angela
|
|
|
|
|
angelagke wrote: Did you means the group or user names for my project properties?
I mean the user name that you are login to windows. Check in computer management console and let me know what is the group membership that your user account belong too.
|
|
|
|
|
i login as computer administrator but don't know what is the group membership for my user account....;P
angela
|
|
|
|
|
I'm looking for a way to print on standard Avery mailing labels. It's for a basic barcode system of our inventory. Can anyone out there help point me in the right direction?
|
|
|
|
|
Hi
I have created a new dataset based on a schema based on my database. I have added a new row a table in the dataset and am now trying to Insert this into the database. When I run it I do not get any errors, or do any records go into the database. What am I doing wrong?
<br />
newDataSet.Tables("tblHouse").Rows.Add(newAddress)<br />
newDataSet.AcceptChanges()<br />
Dim myTable As New DataTable = newDataSet.Tables("tblHouse")<br />
<br />
myAdapter2.Update(myTable)<br />
The FOZ
|
|
|
|
|
hi
try to replace this
Dim myTable As New DataTable = newDataSet.Tables("tblHouse")
by this
myAdapter2.Update(newDataSet,"tblHouse")
Tamimi - Code
|
|
|
|
|
That didn't work. Thanks anyway. Got anymore suggestions?
Cheers
The FOZ
|
|
|
|
|
Don't execute AcceptChanges() until AFTER the .Update() is executed.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Thanks Dave. That has worked for when I am changing a record. What if I have added a new record.
The interface I have at the moment is a simple data bound form bound to a DataTable. The user presses the next button to add a new record. This is the code I used in the button
<br />
Me.BindingContext(myTable).AddNew()<br />
myTable.NewRow()<br />
When I try and save the new record to the database I get an
"System.Data.OleDb.OleDbException" error come up.
Many Thanks for the previous reply.
The FOZ
|
|
|
|
|
Don't call AddNew on the BindingContext object. You're not adding a Binding to anything, soooo...
Call NewRow on the table you want to add a row to. A new DataRow object will be created, according to the schema of the table, and returned. It does not add this row to the table!
Dim nr As DataRow
nr = myTable.NewRow()
You can then set the fields in the new DataRow to whatever you want, then just add it to the table:
myTable.Rows.Add(nr)
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Cheers. Many thanks for that. The book I've got isn't all that good. Couldn't really find an example on the MSDN Either.
Thanks again
The FOZ
|
|
|
|
|
How to access a mdichild in other application which starts in runtime in our own application
bzasri
|
|
|
|