Using SQL Server 2005 Expresss From Visual Basic 6 ?

Jan 17, 2006

I found the following article:

http://msdn.microsoft.com/vbrun/vbfusion/usingsqlexpress/

downloaded the files for it

ran the program and encounter an error about Error Locating Server



anyone tried using that code?

any ideas what I am missing?



thanks.

View 1 Replies


ADVERTISEMENT

How Can I Connect A Sql Server Database To Visual Basic 2005 Express

Oct 8, 2007

Hi, i am new to sql server and visual basic, i need to connect my sql server database to a new application i've developed in visual basic 2005 express. Can any one tell me the steps to do this. Many Thanks.

View 2 Replies View Related

I Cannot Create A Brand New MDF (sql Server Database) With Visual Basic 2005

Apr 20, 2007

Hi everybody:

I go to Server Explorer, right click on Data Connection, input the server name (that is, my own computer), give a new name to the database to create, and then inevitably get the error window saying:

An error occurred while establishing a connection to the server. When connectiong to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL server does not allow remote connections. (Provider: Named Pipes Provider, error 40, could not open a conection to SQL Server)

So, how to open a connection to SQL server 2005? I looked in the msdn but found absolutely nothing.

Please help

Paolo

View 5 Replies View Related

Need Help On A Visual Basic.net Pocket Pc App. With SQL Server CE 2005 And SQL Server 2005 Synchronization Problem

Aug 12, 2007



Hi,
I am developing an application for pocket pc 2003 smart device which utilizes synchronization between SQL CE 2005 and SQL server 2005 by means of REMOTE DATA ACCESS method call PULL( ) and PUSH( ) but currently these are the details of the error Im encountering when PULL( ) method is called:


Error code: -2147467259
Descripion: An error occured on the computer running IIS.Restart the IIS server.

Minor error: 28022
Source: SQL server CE
Currently Im developing this application as a final project and due to some limitations I have setup my pc to act as the SQL server and the IIS server both on the same machine.

Any help will be appreciated, thanks.

View 5 Replies View Related

How Can I Onnect Visual Basic Express 2005 To A Remote SQL Server Express 2005?

Sep 13, 2006

HiIm trying to connect Visual Basic Express 2005 to a remote SQL Server Express 2005. I cant find how i can do that in VB.net Express.In Web developer there are no problem to connect to a remote SQL server but i cant find it in VB.net Express. The XP with the SQL server that i want to connect to is on the local network. Greatful for help!

View 1 Replies View Related

Visual Basic 2005 Express And SQL Server 2005 Express - Display Image

Jun 13, 2007

Hi Guys,
I created a Product database table using Visual Basic 2005 Express and SQL Server 2005 Express. I have just added a new column [Picture] to the database table, which of course, should store an image or picture of a product. I am writing to kindly ask you guys for help .


i) How do I include image files into this column [Picture]?
ii) How do I get this image to display on Visual Basic 2005 Express form, so that when a product is selected the product image is displayed accordingly?


Your help much appreciated. Thanks.

Paul

View 8 Replies View Related

Visual Basic 2005 Problem

Feb 22, 2007

Hi i am trying to trying to delete a reocrd from a Microsoft Access Database in Visual Basic 2005 Express Edition, but come up with this error with the following code. I'm new to vb 2005 and I'm no expert. Appreciate any help given.

-----------------
InvalidCastException was unhandled
Unable to cast COM object of type 'System.__ComObject' to class type 'System.Windows.Forms.TextBox'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface

Dim db1 As Connection
Dim rs As Recordset

db1 = New ADODB.Connection
db1.Provider = "Mircosoft.jet.OLEDB.4.0;"
db1.ConnectionString = "Provider = 'Microsoft.Jet.OLEDB.4.0';Data Source = 'M:Year2 New262CSvb cwrk1vb cwrk1orders.mdb';"
db1.Open()
rs = New ADODB.Recordset
rs.Open("select * from orders", db1, ADODB.CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic)

txtOrderID = rs("OrderID")
txtProduct = rs("Product")
txtPrice = rs("UnitPrice")
txtQuantity = rs("Quantity")
txtDate = rs("OrderDate")
txtRecieved = rs("Received")
txtSupplierID = rs("SupplierID")

Also when i try to add a record to a database i get the following error i have made sure all the data i have typed in the text boxes are the correct data types.
COME Exception was unhandled
No value given for one or more required parameters.

Dim objcommand As Command = New Command()
Dim conn As Connection = New Connection()
Dim cmdreader As Recordset = New Recordset

conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=M:Year2 New262CSvb cwrk1vb cwrk1orders.mdb")
objcommand.ActiveConnection = conn

Dim stqSQLInsert As String
stqSQLInsert = "INSERT INTO Orders(OrderID, Product, Unitprice, Quantity, Orderdate, Received, SupplierID) VALUES (txtOrderID.Text, txtProduct.Text, txtPrice.Text, txtQuantity.Text, txtDate.Text, txtReceived.Text, txtSupplierID.Text)"

objcommand.CommandText = stqSQLInsert
cmdreader.Open(stqSQLInsert, conn, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockOptimistic)

objcommand.Execute()
cmdreader.Update()

Thnx to any who helps...

View 3 Replies View Related

VB.Net (Visual Basic 2005) And MySQL 5.0.41

Jun 15, 2007

Please help me, i am having trouble in Adding data in MySQL Database, and even in Getting or retrieving Data as well.

I use the connection string of Visual Basic 6.0 (ODBC 3.51). Nothing goes wrong with the connection but in updating and adding new data in the MySQL Database then...that's it, nothings go Right!



Please help me in this matter, or can somebody to please give me some simple codes like Address Book using the Visual Basic 2005...







pls pls pls pls pls.... thanx a lot!!!





polarmont@yahoo.com



View 1 Replies View Related

SQL Express && Visual Basic 2005

Jul 10, 2007

Hello,



Iam new to Visual basic 2005, I have installed SQL Express and prefers to use ADODB to connect to the database.

This is the code i tried

con.Open(cstring1 = "Provider=SQLNCLI.1;" _

& "Server=(local);" _

& "Database=D:VS 2005 ProjectsMyDB.mdf;" _

& "Integrated Security=SSPI;" _

& "DataTypeCompatibility=80;" _

& "Data Source=server1sqlexpress")



The error is comexception was unhandled,

SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].



Can anyone help me out.

I have SQLExpress installed and Visual studio 2005 installed.

Connection string for ADODB ??



Regards,



Sathyan

View 4 Replies View Related

Visual Basic 2005 Express - SQL Problem

Nov 21, 2007

Hi all, I have a var called sEP which contains a number. The problem I have is calling that var during an SQL query within Visual Basic.  To test the update string I wrote the following query and simply told it to enter the text "Five Stars" on the row which contains the entry '1' in Episode Number column. It works fine. UPDATE JackBennySET Rating= 'Five Stars'
WHERE ([Episode Number]= '1') But how do I replace the '1' in the query with the var sEP (which will contain the actual number I want the query to run against)?I have tried various suggestions from sources including:UPDATE JackBenny SET Rating = 'Five Stars' WHERE [Episode Number] = '" + sEp + "'However, they all fail to update the database at all which makes me think the syntax is incorrect.Any help is very appreciated (I have been seeking help in various places for 2 days now) - I always send small paypal tips to people who help me on forums.       

View 4 Replies View Related

SQL Express 2005 Replication Via Visual Basic

May 9, 2006

yiotis writes "Is there a way where you can programmatically (via visual basic) replicate two or more SQL Express databases located on multiple computers without the need of SQL Server 2005 acting as a publisher. From what i understand this is a limitation in SQL Express.

Right now i have SQL Express installed on 2 machines. I am able via vb to communicate with each database, read and write data between databases but cannot seem to figure out how to perform a simple replication.

Bottom line is, i need to be able to replicate via vb code 2 sql express databases with each other.

Thanks"

View 1 Replies View Related

Use Adobe Pdf Files With Visual Basic 2005

Sep 16, 2007

Hi everyone.
I try to develop an application where one of the items is files management. I wish to store the adress (local disk) into the MS SQL 2005 table and from one form, with some controls (AxAcroPDF), to access this pdf files.
Can someone help me?

View 1 Replies View Related

Visual Basic .NET 2005 Express && Sql Server 2005 Express Remote Server

Mar 12, 2007

Hi,
 I want to make a component library in Visual Basic.NET and connect to a remote Sql Server. When I create a new DataSet with the wizard, I can only connect to a .mdf file, but not to a Sql Server. With Visual Web Developer I can connect to a Sql server. What is the difference between these enviroments ? How can I do the same with Visual Basic.NET ?
 Thanks in advance.

View 1 Replies View Related

SQL 2005 Process Growing Very Large Working With Visual Basic 6

Sep 25, 2006

We recently installed SQL server 2005 on a couple of our servers.  I use Visual Basic 6.0 at the moment and use ADO to connect to our various SQL servers.

I recently discovered on one of the new servers, that every time my programs runs, (every 4 minutes for 12 hours a day) the SQL process shown in task manager grows by 1-10 Megs.

The SQL process was at 776,912K when I rebooted this afternoon.  It started back up at 106,120K.

I am not doing anything differently than I did when my programs were talking to SQL 2000, and I have never seen this memory leak issue.  Is there something extra I need to do in SQL 2005 to finish/clear these SQL queries and not bog down SQL's memory?







An example of how I would connect and do a SQL transaction:

Dim cn as ADODB.Connection

Dim rs as ADODB.RecordSet


Set cn = New ADODB.Connection

Set rs = New ADODB.Connection

cn.Open strConnect

select1 = "select firstName, lastName from clients"
rs.Open select1, cn, adOpenKeyset, adLockOptimistic

If rs.EOF = False Then

    rs.AddNew

End If


rs!firstName = Trim(Text1(0))
rs!lastName = Trim(Text1(1))

rs.Update

rs.Close
cn.Close

At the end of the program's run I would:

Set cn = Nothing

Set rs = Nothing

View 3 Replies View Related

Adding, Deleting Rows From Visual Basic 2005 Express Edition

May 27, 2007



Hi,



I'm a complete novice concerning SQL Server (Express Edition)

I'm trying to Add or Delete rows froma VB 2005 Express Function or Sub. While the program is running everything is ok. Except when restarted added records are gone and deleted records are back.



Have i missed an option during installation?



Thx,

Steven

View 5 Replies View Related

Visual Basic And Sql Server

Jan 3, 2004

Hi experts I am new to SQL Server and have got to do a project using VB & SQL Server. right now i got to prepare case study document wherein i got to mention the pros & cons of using VB+sql server... kindly help me. Thanks in advance.

View 1 Replies View Related

Visual Basic Connecting To MS SQL Server

Aug 3, 2001

is there any way to use Visual Basic and MSSQL without using ODBC?
please let me know.

View 1 Replies View Related

System.Data.ConstraintException Visual Basic 2005 Express / SQL 2005 Express

Aug 18, 2006

This problem only occurs after deployment, not when debugging. In the table I am having a problem with I have an ID field designated as the primary key with the identity increment set to 1 and the identity seed set to 1. There is no data in the table when deployed. I can add records to the datagridview control but when I try updating the dataset I get this error indicating that the ID field already has a value of 1 present. If I close the application and re-start it, the exception no longer occurrs when I update the dataset. I am including the code to update the tables incase something is wrong there. Any suggestions?

Private Sub UpdateMemberTable()

Me.Validate()

Me.TblMembersBindingSource.EndEdit()

Me.TblMembersTableAdapter.Update(Me.ChurchFamilyDataSet.tblMembers)

Me.TblMemberDependentsBindingSource.EndEdit()

Me.TblMemberDependentsTableAdapter.Update(Me.ChurchFamilyDataSet.tblMemberDependents)

Me.TblMemberContributionsBindingSource.EndEdit()

Me.TblMemberContributionsTableAdapter.Update(Me.ChurchFamilyDataSet.tblMemberContributions)

End Sub

View 3 Replies View Related

Visual Basic 6.0 Connect To SQL Server 2000

Jul 20, 2005

We have forms written in Visual Basic 6.0. They were previouslywritten for an Access database which was moved to SQL Server 2000.Here's the connect string I used:ODBC;UID=visualbasic;PWD=password;SERVER=MPSQL;DRI VER={SQLSERVER};DATABASE=MPPhotoThe user visualbasic and the user logged in to the computer have fullrights to the database.When they open the form which is based on a view it is opened as readonly with an error 3027. The data control is not set to read only.The database file is not read only. All of the permissions are set toallow this user read, write and modify.Can anyone hep me?

View 3 Replies View Related

Sql Server 2005 Express Edition VS Visual Basic 2005 Express Edition

Dec 1, 2006



Hello..

I've installed Visual Basic 2005 express edition & tried to connect to SQL Server 2005 express edition. I noticed that VB2005 Express Edition doesn't have any OLEDB provider for SQL Server. The only OLEDB Provider is for M.Access. Is this correct? if so, what should i do if i want to connect SQL Server 2005 express edition with VB2005 express edition by using OLEDB connection type?

I really appreciate any respond from you guys.. Thank's and waiting for the good news..

Best regards,
VITRELLE

View 1 Replies View Related

T-SQL And Visual Basic 2005 Codes That Execute A User-Defined Stored Procedure In Management Studio:How To Declare EXEC && Sp?

Jan 17, 2008

Hi all,

In my SQL Server Management Studio Express (SSMSE), I executed the following sql code suuccessfully:
--insertNewRocord.sql--

USE shcDB

GO

CREATE PROC sp_insertNewRecord @procPersonID int,

@procFirstName nvarchar(20),

@procLastName nvarchar(20),

@procAddress nvarchar(50),

@procCity nvarchar(20),

@procState nvarchar(20),

@procZipCode nvarchar(20),

@procEmail nvarchar(50)

AS INSERT INTO MyFriends

VALUES (@procPersonID, @procFirstName, @procLastName, @procAddress,

@procCity, @procState, @procZipCode, @procEmail)

GO

EXEC sp_insertNewRecord 7, 'Peter', 'Wang', '678 Old St', 'Detroit',

'Michigon', '67899', 'PeterWang@yahoo.com'

GO

=======================================================================
Now, I want to insert a new record into the dbo.Friends table of my shcDB by executing the following T-SQL and Visual Basic 2005 codes that are programmed in a VB2005 Express project "CallshcDBspWithAdoNet":
--Form1.vb--

Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Public Class Form1

Public Sub InsertNewFriend()

Dim connectionString As String = "Integrated Security-SSPI;Persist Security Info=False;" + _

"Initial Catalog=shcDB;Data Source=.SQLEXPRESS"

Dim connection As SqlConnection = New SqlConnection(connectionString)

connection.Open()

Try

Dim command As SqlCommand = New SqlCommand("sp_InsertNewRecord", connection)

command.CommandType = CommandType.StoredProcedure


EXEC sp_insertNewRecord 6, 'Craig', 'Utley', '5577 Baltimore Ave',

'Ellicott City', 'MD', '21045', 'CraigUtley@yahoo.com'


Console.WriteLine("Row inserted: " + _

command.ExecuteNonQuery().ToString)

Catch ex As Exception

Console.WriteLine(ex.Message)

Throw

Finally

connection.Close()

End Try

End Sub

End Class

===========================================================
I ran the above project in VB 2005 Express and I got the following 5 errors:
1. Name 'EXEC' is not declared (in Line 16 of Form1.vb)
2. Method arguments must be enclosed in parentheses (in Line 16 of Form1.vb)
3. Name 'sd-insertNewRecord' is not declared. (in Line 16 of Form1.vb)
4.Comma, ')', or a valid expression continuation expected (in Line 16 of Form1.vb)
5. Expression expected (in Line 16 of Form1.vb)
============================================================
I know that "EXEC sp_insertNewRecord 6, 'Craig', 'Utley', '5577 Baltimore Ave',

'Ellicott City', 'MD', '21045', 'CraigUtley@yahoo.com' "in Line 16 of Form1.vb is grossly in error.
But I am new in doing the programming of T-SQL in VB 2005 Express and I am not able to change it.

Please help and advise me how to correct these problems.

Thanks in advance,
Scott Chang

View 22 Replies View Related

T-SQL And Visual Basic 2005 Codes That Execute A User-Defined Stored Procedure In Management Studio Express (Part 2)

Jan 23, 2008

Hi Jonathan Kehayias, Thanks for your valuable response.

I had a hard time to sumbit my reply in that original thread yesterday. So I created this new thread.

Here is my response to the last code/instruction you gave me:

I corrected a small mistake (on Integrated Security-SSPI and executed the last code you gave me.

I got the following debug error message:

1) A Box appeared and said: String or binary data would be truncated.

The statement has been terminated.

|OK|

2) After I clicked on the |OK| button, the following message appeared:

This "SqlException was unhandled

String or binary data would be truncated.

The statement has been terminated."

is pointing to the "Throw" code statement in the middle of

.......................................

Catch ex As Exception

MessageBox.Show(ex.Message)

Throw

Finally

..........

Please help and advise how to correct this problem in my project that is executed in my VB 2005 Express-SQL Server Management Studio Express PC.



Thanks,
Scott Chang

The code of my Form1.vb is listed below:

Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

Public Class Form1

Public Sub InsertNewFriend()

Dim connectionString As String = "Data Source=.SQLEXPRESS;Initial Catalog=shcDB;Integrated Security=SSPI;"

Dim connection As SqlConnection = New SqlConnection(connectionString)

Try

connection.Open()

Dim command As SqlCommand = New SqlCommand("sp_insertNewRecord", connection)

command.CommandType = CommandType.StoredProcedure

command.Parameters.Add("@procPersonID", SqlDbType.Int).Value = 7

command.Parameters.Add("@procFirstName", SqlDbType.NVarChar).Value = "Craig"

command.Parameters.Add("@procLastName", SqlDbType.NVarChar).Value = "Utley"

command.Parameters.Add("@procAddress", SqlDbType.NVarChar).Value = "5577 Baltimore Ave"

command.Parameters.Add("@procCity", SqlDbType.NVarChar).Value = "Ellicott City"

command.Parameters.Add("@procState", SqlDbType.NVarChar).Value = "MD"

command.Parameters.Add("@procZipCode", SqlDbType.NVarChar).Value = "21045"

command.Parameters.Add("@procEmail", SqlDbType.NVarChar).Value = "CraigUtley@yahoo.com"

Dim resulting As String = command.ExecuteNonQuery

MessageBox.Show("Row inserted: " + resulting)

Catch ex As Exception

MessageBox.Show(ex.Message)

Throw

Finally

connection.Close()

End Try

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

InsertNewFriend()

End Sub

End Class

View 6 Replies View Related

Newbie Question: Debugegr For SQL Server 2000 (e.g. Through Visual Basic???)

Apr 28, 2004

I am using the SQL Server 2000 query analyser to write stored procedures for an SQL Server 2000 database.

I would like to find a debugger to help me "look into" my stored procedures as they are executed (e.g. to watch a Cursor fill a table row by row, see the contents of temporary tables as a stored procedure progresses, etc.)

Could anybody, please, direct me to-

* Any debugger that does this
OR
* Simple instructions how to run stored procedures from Visual Basic. I suspect :) that VB's debugger may be able to look into the SQL as it is being executed, but I don't actually know how to use VB itself.

Thanks very much,

Angelos

View 3 Replies View Related

Need For Multi-Threaded Visual Basic.NET To SQL Server Data Access Example Code

Feb 10, 2007

Of all the Visual Basic.NET data access books that I have purchased and all the Internet site example code that I have reviewed, none have had any good examples of multi-threaded VB.NET code doing data access.

I am trying to avoid the non-responsiveness in a VB app while a simple data retrieval from SQL Server 2005 is in progress.

If anyone knows of any book titles or web sites that have example code (good or not) of multi-threaded VB.NET applications doing data access against Microsoft SQL Server (7, 2000, or 2005) or even against Microsoft Access(TM), it would be very much appreciated if you could provide the book title or URL to point me in the right direction.

The more examples the better.

Thanks in advance.

View 5 Replies View Related

Visual Basic Slow Down Sql Server 2000 Running A Stored Procedure

Nov 30, 2007

I hav the following problem. I have written an stored procedure in sql server 2000 as the following
CREATE PROCEDURE dbo.pa_rellena
@pFechaInicio datetime

AS
declare @pFechaFin datetime
declare @auxcod_cen char(10)

declare @importeEfectivo decimal(17,2)
declare @importeTarjetas1 decimal(17,2)
declare @importeTarjetas2 decimal(17,2)
declare @importeVales decimal(17,2)
declare @importeTalones decimal(17,2)
declare @importeGastos decimal(17,2)


select @pFechaFin=@pFechaInicio+1


--Borramos las tablas temporales si las hemos creado con anterioridad y no se han borrado
if object_id('tmpCentros') is not null
drop table tmpCentros

if object_id('tmpCentros2') is not null
drop table tmpCentros2

if object_id('tmpMaxCajas') is not null
drop table tmpMaxCajas

if object_id('tmpCajasCentro') is not null
drop table tmpCajasCentro

if object_id('tmpVales') is not null
drop table tmpVales

if object_id('tmpDiarioEfectivo') is not null
drop table tmpDiarioEfectivo

if object_id('tmpDiarioTalones') is not null
drop table tmpDiarioTalones

if object_id('tmpDiarioTarjetas') is not null
drop table tmpDiarioTarjetas

if object_id('tmpDiarioSegundaForma') is not null
drop table tmpDiarioSegundaForma

if object_id('tmpDiarioGastosTarjetas') is not null
drop table tmpDiarioGastosTarjetas

if object_id('temp1') is not null
drop table temp1

--Seleccionamos todos los centros de Salvador Bachiller
select * into tmpCentros2
from centros
where centros.tienda=1
order by cod_cen

--Seleccionamos el maximo de cajas por cada centro

select cod_cen, max(cod_caja) as cajas into tmpMaxCajas
from cierrecaja
where fecha>=@pFechaInicio and fecha<@pFechaFin
group by cod_cen
order by cod_cen

--Mezclamos los centros con el maximo de cajas
select c.cod_cen, c.Centro, c.Direccion, c.localidad, c.provincia, c.cpostal, c.telefono, m.cajas, operaciones, cajas_tot, tienda, franquicia into tmpCentros
from tmpCentros2 as c left outer join tmpMaxCajas as m on c.cod_cen=m.cod_cen

--Cajas por centro
select distinct cod_cen as cod_cen, cod_caja as cod_caja into tmpCajasCentro
from cierrecaja
where fecha>=@pFechaInicio and fecha<@pFechaFin

--Los vales de cada centro
select cod_cen,sum(importe) as imp1 into tmpVales
from vales where
fecha>=@pFechaInicio and fecha<@pFechaFin
group by cod_cen

--Efectivo de cada centro
select cod_cen,'01' as vendedor,'EFECTIVO' as descripcion, (sum(diario.TotEuro)-Sum(Diario.Imppa2)) as importe1,0 as exp1, (sum(Diario.TotEuro)-sum(Diario.imppa2)) as importe2 into tmpDiarioEfectivo
from diario
where fecha>=@pFechaInicio and fecha<@pFechaFin and cod_cen in (select cod_cen from tmpCentros) and cod_caja in (select cod_caja from tmpCajasCentro) and diario.cod_pago='01'
group by cod_cen

--Talones por centro
select centros.cod_cen,'02' as vendedor,'TALONES' as descripcion, sum(diario.TotEuro) as importe1,0 as exp1, sum(Diario.TotEuro) as importe2 into tmpDiarioTalones
from centros inner join diario on centros.cod_cen=diario.cod_cen
where fecha>=@pFechaInicio and fecha<@pFechaFin and diario.cod_cen in (select cod_cen from tmpCentros) and cod_caja in (select cod_caja from tmpCajasCentro) and diario.cod_pago='02'
group by centros.cod_cen

--Tarjetas por centro
select cod_cen,'03' as vendedor,'TARJETAS' as descripcion, sum(diario.TotEuro) as importe1,0 as exp1, sum(Diario.TotEuro*(FPago.Descuento/100)) as importe2, sum(Diario.TotEuro) - sum(Diario.TotEuro*(FPago.Descuento/100)) as importe3 into tmpDiarioTarjetas
from FPago left join Diario on fpago.Cod_pago=Diario.cod_pago
where fecha>=@pFechaInicio and fecha<@pFechaFin and cod_cen in (select cod_cen from tmpCentros) and cod_caja in (select cod_caja from tmpCajasCentro) and Fpago.Descuento<>0
group by cod_cen

--Segunda Froma de Pago
select cod_cen,'03' as vendedor,'TARJETAS' as descripcion,sum(diario.imppa2) as importe1 into tmpDiarioSegundaForma
from fpago left join Diario on Fpago.cod_pago=diario.cod_pa1
where fPago.cod_pago<>'99' and fecha>=@pfechaInicio and fecha<@pFechaFin and cod_cen in (select cod_cen from tmpCentros) and cod_caja in (select cod_caja from tmpCajasCentro) and Fpago.Descuento<>0
group by cod_cen

--Comisiones tarjetas de pago
select cod_cen,'10' as vendedor, 'GASTOS (-)' as descripcion, sum(Diario.imppa2*(fPago.Descuento/100)) as importe2 into tmpDiarioGastosTarjetas
from Fpago left join Diario on FPago.cod_pago= Diario.cod_pa1
where fPago.cod_pago<>'99' and fecha>=@pFechaInicio and fecha<@pFechaFin and cod_cen in (select cod_cen from tmpCentros) and cod_caja in (select cod_caja from tmpCajasCentro) and Fpago.Descuento<>0
group by cod_cen
/*
--Venta neta por centro
declare cursortemporal cursor for select cod_cen from TmpCentros2

open cursortemporal
delete detallecaja_aux
fetch next from cursortemporal into @auxcod_cen
while @@fetch_status=0
Begin
select @importeVales=imp1 from tmpVales where cod_cen=@auxcod_Cen
select @importeEfectivo=importe2 from tmpDiarioEfectivo where cod_cen=@auxcod_Cen
select @importeTalones=importe2 from tmpDiarioTalones where cod_cen=@auxcod_cen
select @importeTarjetas1=importe3 from tmpDiarioTarjetas where cod_cen=@auxcod_cen
select @importeTarjetas2=importe1 from tmpDiarioSegundaForma where cod_cen=@auxcod_cen
select @importeGastos=importe2 from tmpDiarioGastosTarjetas where cod_cen=@auxcod_cen

select @importeVales=isnull(@importeVales,0)
select @importeEfectivo=isnull(@importeEfectivo,0)
select @importeTalones=isnull(@importeTalones,0)
select @importeTarjetas1=isnull(@importeTarjetas1,0)
select @importeTarjetas2=isnull(@importeTarjetas2,0)
select @importeGastos=isnull(@importeGastos,0)

print @auxcod_cen
print @importeVales
print @importeEfectivo
print @importeTalones
print @importeTarjetas1
print @importeTarjetas2
print @importeGastos

insert into detallecaja_aux (cod_cen,importe1)
values(@auxcod_cen, @importeVales+@importeEfectivo+@ImporteTalones+@ImporteTarjetas1+@importeTarjetas2-@importeGastos)
fetch next from cursortemporal into @auxcod_cen

select @importeVales=0
select @importeEfectivo=0
select @importeTalones=0
select @importeTarjetas1=0
select @importeTarjetas2=0
select @importeGastos=0
end

close cursortemporal
*/
select * from detallecaja_aux
GO

When I try to run it from visual basic it slow down the sql server.

What can I do?

View 2 Replies View Related

DTS And Visual Basic

May 15, 2001

I have already created package which loads a text file to database using the dts wizard in Enterprise Manager.How do I execute that package using visual basic?Please provide the Code!!!Thanks

View 2 Replies View Related

Visual Basic

Jan 19, 1999

I need help.
160821A network error was encountered while sending results to the front end. Check the SQL Server errorlog for more information.
I need help.
Our SQL Server is crashing. The Database is still recovering. I can not kill any Process when the Server crashed. I shoot down and restarted the server. Nothing to do. I can not access to the database. It is recovering. How long? I do not know. What can be the reason of the recovering? Nor the event log of Windows NT or the log files of the SQL SERVER can help me.

Here is a part of the log file

23216Arithmetic overflow error for type %s, value = %f.

10915There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.

99/01/19 01:14:25.69 spid25 bufwait: timeout, BUF_IO, bp 0x1bba600, pg 0x11b50, stat 0x801000/0x6, obj 0x23494814, bpss 0x124a2a0
99/01/19 01:14:27.15 ods Error : 17824, Severity: 10, State: 0
99/01/19 01:14:27.15 ods Unable to write to ListenOn connection '.pipesqlquery', loginname 'sa', hostname 'myserver'.
99/01/19 01:14:27.15 ods OS Error : 232, The pipe is being closed.

View 4 Replies View Related

Visual Basic .NET

Oct 22, 2004

Anyone know any good Visual Basic .NET STep By Step books for an almost beginner.

View 2 Replies View Related

Visual Basic

Feb 27, 2008

What code can I write so that the output is in US dollars?

View 3 Replies View Related

Visual Basic 6.0

Mar 22, 2007

Greetings,

Firstly, apologies if this topic is out of the scope of this board, but I am stumped.

Basically, we have an old Visual Basic 6.0 application which currently accesses an Access database, but which we would like to upgrade to an SQL compact edition database. I have created the database, but have so far turned up next to no details reagarding how to connect to the damn thing in VB6.

Can anyone help? Or at least point me in the right direction?

Many thanks,

MadSkunk

View 11 Replies View Related

Visual Basic, OLE DB Provider And DTS

Oct 25, 1999

I want to use Visual Basic to create DTS connection. In the example below a connection is created using an ODBC string. However, I would like to make the Connection's DataSource be an OLE-DB provider instead of ODBC. However, I cannot find any information on the syntax for using an OLE-DB provider as the DataSource.

Your help is appreciated.

Les

strODBCdsn = "server1" 'Create a DSN called SQL7 or change name
strUserName = "sa" 'User name assume same source and dest
strPassword = "" 'with the same Password
Set oConnection = oPackage.Connections.New
oConnection.ID = 1
oConnection.DataSource = strODBCdsn
oConnection.UserID = strUserName
oConnection.Password = strPassword
oPackage.Connections.Add oConnection

View 2 Replies View Related

Run DTS Package From Visual Basic 6.3

Jan 6, 2005

Anyone have any code i can use to call a DTS package from Visual Basic. I would like to have an outlook macro that will run a dts package when i receive an email. All i need is the code that will call a dts package for a sql server that is not local to the box. I've tried this code but i get an error
run_tmie error '-2147217900 (80040e14)' automation error


Public Sub main()

Dim oPkg As DTS.Package2
Set oPkg = New DTS.Package2

oPkg.LoadFromSQLServer MyServerName, MyUserName, MyPassword, , MyDTSPackageName

oPkg.Execute
oPkg.UnInitialize

Set oPkg = Nothing

End Sub







Thanks in advance.

View 1 Replies View Related

Which Better For Visual Basic Developer

Jun 19, 2006

hi
i found these books for learnning sql server
which better to read for Visual Basic Developer ??


http://www.sqlserver2005books.com/1-3805-0735622507-%20Microsoft_SQL_ServerTM_2005_Reporting_Services_Step_by_Step_Step_by_Step_Microsoft.html

------------------------

http://www.sqlserver2005books.com/1-3805-0735622078-%20Microsoft_SQL_ServerTM_2005_Database_Essentials_Step_by_Step_Step_By_Step_Microsoft.html

thank you

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved