I have Visual Studio 2010, with SQL EXPRESS which came with VS2010 from what I understand. I built a database in my VB.NET project, and am trying to copy data from the corporate SQL SERVER to my VB.NET created database (SQL EXPRESS).
Below I've included my script, with both connection strings. The SQL SERVER version works, but not the SQL EXPRESS one. If anyone could led me in the right direction, it would be much appreciated.
Below I've included my script, with both connection strings. The SQL SERVER version works, but not the SQL EXPRESS one. If anyone could led me in the right direction, it would be much appreciated.
VB.NET:
[COLOR=#000000][FONT=verdana]
[/FONT][/COLOR]Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
'SQL EXPRESS COnnection String
Dim con As SqlConnection = New SqlConnection("Server=OVP-L-R8MXE5M\SQLEXPRESS;" & "Database=dbTest;" & "Trusted_Connection=TRUE;")
'SQL SERVER COnnection String
'Dim con As SqlConnection = New SqlConnection("Server = ***-*-*******;" & "Database = CMP;" & "Trusted_Connection=TRUE")
con.Open()
Dim cmd As SqlCommand = New SqlCommand("INSERT INTO dbTest.cbo.tblFactSales ( BILLTO,BRANCHPLANT,COMPANY,DATASRC,DATATYPE,FRTHANDLE,MODE,ORDERTYPE,ORIGINPLANT,PRODUCT,RPTCURRENCY,SALESDATA,SHIPTO,TIMEID,SIGNEDDATA,SOURCE ) " & _ "SELECT CMP.dbo.tblFactSales.* " & _
"FROM CMP.dbo.tblFactSales " & _
"WHERE DATATYPE='FORECAST' AND TIMEID='20120700'", con)
cmd.ExecuteNonQuery()
MessageBox.Show("Records Moved Successfully.", "Move Complete", _
MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) [LEFT][COLOR=#000000]
End Sub
[/COLOR][/LEFT]
Last edited: