|
Cheers, I'll have a look.
Dave.
|
|
|
|
|
I have a MS-SQL 2000 db with a timestamp field. What is the best type in c# to use to store the value of a timestamp?
The Doc's suggest that it is an 8 Byte number and that it should be stored in a DateTime. Is this correct?
Thanks
Stephen.
|
|
|
|
|
This is the situation. We have an online SQL server powering a web site, and then another SQL server powering a back-office system. The web site SQL server is online all the time while the back-office SQL server only ever comes online when the users dial up.
When the users dial up we want to synch the two databases to contain identical data. Now while the back-office SQL server was offline the users could have entered in many records as well as many records being recorded on the web site SQL server. Obviously these records have unique IDs and primary keys associated with them, so we need to maintain relationships etc.
Neither is the "central" server so we cannot just replicate one to the other.
Does any body have any pointers as to what the most reliable method is of achieving this? Any links to tutorials, walk throughs, forums etc. on the subject would be much appreciated, ta.
|
|
|
|
|
Maybe I'm not thinking about this correctly, but if you are using SQL Server 7+ can't you use Merge replication. With merge replication you don't need a "master" db. One DB has to be the publisher and others can be subscribers. With merge replication you can enter data in any of the DB's and have it replicated to the others.
|
|
|
|
|
Matt Gullett wrote:
Maybe I'm not thinking about this correctly, but if you are using SQL Server 7+ can't you use Merge replication
No you are thinking about it perfectly well. Merge replication is what I am setting up, but I thought it best to ask you guys if there were better alternatives.
Thanks
|
|
|
|
|
Has anyone ever created a DTS package, then saved it to a .bas file to be used in VB? We are doing that on a project at work where we are having some issues. The DTS script is making a connection to a database and then specifying a flat file as another source. The idea here is to pump the data (160,000 records) over to the database into a table. While this is an extremely efficient method one of our users can not do this. The pump basically fails. No data gets moved at all. I know the connection is established through SSPI however I am not sure what could be going wrong. This may seem vague, but has anyone run into issues like this before?
Nick Parker
If the automobile had followed the same development as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year killing everyone inside.
-Robert Cringely
|
|
|
|
|
I have a DTS package that was failing; but i created a user on the SQL database with just enough permissions and modified the DTS to use that authentication instead of Windows Authentication, it worked.
It could be the Windows login that he is trying to do this from does not have suffcient rights.
I am yet to figure out the problem in the other case.
I do not know whether it would apply to jour scenario. I never created a VB DTS package
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Thomas George wrote:
i created a user on the SQL database with just enough permissions and modified the DTS to use that authentication instead of Windows Authentication, it worked.
Could you show how you switched the authentication to SQL from NT, I'm not sure how I can convert this. I tried to switch it over to an ADODB connection, however it wouldn't take that and we are going to SQL Server.
Set oConnection = goPackage.Connections.New("SQLOLEDB")
oConnection.ConnectionProperties("Integrated Security") = "SSPI"
oConnection.ConnectionProperties("Persist Security Info") = False
oConnection.ConnectionProperties("Initial Catalog") = "[OurTableName]"
oConnection.ConnectionProperties("Data Source") = "[OurServerName]"
oConnection.ConnectionProperties("Application Name") = "DTS Designer"
oConnection.Name = "[OurServerName]"
oConnection.ID = 1
oConnection.Reusable = True
oConnection.ConnectImmediate = False
oConnection.DataSource = "[OurServerName]"
oConnection.ConnectionTimeout = 60
oConnection.Catalog = "Reference"
oConnection.UseTrustedConnection = True
oConnection.UseDSL = False
Nick Parker
If the automobile had followed the same development as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year killing everyone inside.
-Robert Cringely
|
|
|
|
|
Actually, you can dump any DTS out to VB... It's cryptic as hell to read if you have a complex one cause DTS doesn't choose damnes worth a darn. In a cast like yours, I usually embed some kind of logging mechanism into the DTS package to get the returned status codes. And security can be a problem for running stuff, but it's usually only if run manually. The agent running stuff is usually set to go from install to run against any db.
Mark
|
|
|
|
|
Can anyone suggest me the line of codes and the data type of the field through which we can store files in an SQl Server Database through an ODBC Recordset
Samir Sood
|
|
|
|
|
You question is unclear. Please try again. Do you want to save binary data, i.e. "files", in a field in a SQL Server database? As far as the lines of code, you would use an INSERT statement to store new rows and an UPDATE statement to modify existing rows.
|
|
|
|
|
I want to store actual files i.e txt , rtf and doc files in the database .
Please Give the ines of code to insert and update them throgh odbc in MFC.
Samir Sood
|
|
|
|
|
You can store anything into BINARY database fields.
Read/Store the file to/from CLongBinary.
You can use CLongBinary variable in RFX_LongBinary for typed recordset.
Pavel
Sonork 100.15206
|
|
|
|
|
I want to send email from SQL server. Please tell me how? Do tell me complete procedure as how to make SQL server, an email client and what to do next ????
|
|
|
|
|
|
Just like this...
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo.p_SampleDateRangeProc]
@StartDate datetime,
@EndDate datetime
AS
select * from YourTable t (nolock)
where t.DateField >= @StartDate
and t.DateField <= @EndDate
If @@Error <> 0
Return -1
Return 0
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
SELECT Country_Ext_Code FROM Countries_Extensions WHERE (NOT (Country_Ext_Code IN (SELECT country_ext_code FROM rates_phone_zones WHERE Rate_Group_Phone_Code = ?))) doesn't works.
SELECT Country_Ext_Code FROM Countries_Extensions WHERE (NOT (Country_Ext_Code IN (SELECT country_ext_code FROM rates_phone_zones WHERE Rate_Group_Phone_Code = 1))) works fine.
* Note the change "?" x "1"
|
|
|
|
|
What on earth are you trying to achieve with
WHERE Rate_Group_Phone_Code = ?
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
To answer this, we'll need to know what you want to do. SQL doesn't know what you want to do either.
|
|
|
|
|
? is the parameter.
Generally, if you try the sql sentence with the ? in the SQL Query Analizer, the parameter windows should be appears waiting input a value (ej. 1), but with the descripted query (with ?), SQL generate an error; with 1 value works fine. See TABLES DEFINITION
If you try "SELECT country_ext_code FROM rates_phone_zones WHERE Rate_Group_Phone_Code = ?) " this works fine in the query analizer.
The question is -Can be used the IN (SELECT ... clause with a parameter ?-
With the ? the SQL engine say: Syntax error or access violation
Invalid descriptor index
TABLES DEFINITION
TABLE Countries_Extensions
country_ext_code(PK) country_name
1 USA
297 ARUBA
54 ARGENTINA
TABLE Rates_Phone_Zones
country_ext_code(FK) Rate_Group_Phone_Code
1 1
297 1
The query should be show:
Countries_Extensions.country_ext_code
54
in this case the ? is the Rate_Group_Phone_Code value from a user input (ej. Rate_Group_Phone_Code 1).
I need to show all the countries extensions codes(really just the countries names) that does´t exists in the Rates_Phone_Zones.
|
|
|
|
|
Hi,
I have some problem with this query i execute under visual C++6.0
"SELECT Nom, CodePostal, Sum(Montant) AS MontantRemb, DateTraitement <br />
FROM TClient GROUP BY Nom, CodePostal, Montant,DateTraitement <br />
HAVING (((DateTraitement)=#09/05/2002#));"
In Microsoft Access interface it work well but if i execute it via ODBC like this :
retcode = SQLExecDirect(m_hstmt,(SQLCHAR*)strSQL, SQL_NTS);
this isntruction work also but i have a problem with SQL Fetch:
while (( retcode = SQLFetch(m_hstmt))!= SQL_NO_DATA)<br />
{ <br />
SQLGetData(m_hstmt, 1, SQL_C_CHAR, szNomClient, 25, &cbName);<br />
SQLGetData(m_hstmt, 2, SQL_C_CHAR, szCodePostal, 6, &cbName);<br />
SQLGetData(m_hstmt, 3, SQL_C_CHAR, szMontant, 16, &cbName);<br />
SQLGetData(m_hstmt, 4, SQL_C_CHAR, szDateTraitement, 11, &cbName);<br />
} Here retcode return 100 and i can't obtain my data
Thanks in advance for any help
|
|
|
|
|
I am working on a large-scale enterprise application that needs to output a large amount of data in a short time. An older version of the program used DAO, and now, after rewriting in .NET it uses either the Jet OleDb or Sql .NET providers. While the .NET version is significantly faster in performing the calculations of the data that needs to be output, it is excessively slower in outputing it...
I created a console app to perform an empirical comparison. For each data access technology I output 8760 records with each record containg one Date field and 40 Single fields... For the .NET providers I create an INSERT command and execute it 8760 times (repopulating with random values). For the DAO (using an auto-generated interop assembly) I open a recordset on the table and for each record I call Recordset.AddNew, set the values, and then call Recordset.Update...
The results:
Jet DAO - 7 seconds
Sql .Net Provider - 37 seconds
Jet OleDb .Net Provider - 57 seconds
Are the .Net providers not written with massive outputing of data in mind? Does anyone know if someone has written a wrapper around DAO that lets it fit into the System.Data class heirarchy (I'd be very interested in that)? Is there a better way to output a large number of records in .NET (I've tried using DataAdapters which made no difference)?
This matters a lot for me since the new application takes around 4-5 times as long to calculate and output its results (which really matters since this equates to about 8-9 hours per run of the application)..
|
|
|
|
|
I would really like to see all the code (possibly a small article) to see exactly what you are doing. Have you read Nish and Rama's co-article yet with a slew comparison on different Microsoft languages? If not I would highly recommend reading it.
A statistical analysis of the performance variations of assorted managed and unmanaged languages [^]
Nick Parker
If the automobile had followed the same development as the computer, a Rolls-Royce would today cost $100, get a million miles per gallon, and explode once a year killing everyone inside.
-Robert Cringely
|
|
|
|
|
He is all of the code... It assumes that there exists an Access db at c:\test.mdb and a SQL db called testSQL on an instance at COMPUTER\SQLServer... The dbs each contain one table named Test, defined by one Date field (Observation) and 40 Single fields (Val1, Val2, ...). The project has a reference to DAO 3.6 Object Library...
Imports System.Data.OleDb
Imports System.Data.SqlClient
Module Module1
Sub Main()
Randomize(-1000)
Dim start As Date = Date.Now
ExecuteDAO()
System.Console.WriteLine("DAO output took " & DateDiff(DateInterval.Second, start, Date.Now) & " seconds.")
start = Date.Now
ExecuteOleDb()
System.Console.WriteLine("OleDb output took " & DateDiff(DateInterval.Second, start, Date.Now) & " seconds.")
start = Date.Now
ExecuteSql()
System.Console.WriteLine("Sql output took " & DateDiff(DateInterval.Second, start, Date.Now) & " seconds.")
System.Console.WriteLine("Press any key to continue...")
System.Console.Read()
End Sub
Public Function ExecuteOleDb()
Dim conn As OleDbConnection
Dim cmd As IDbCommand
Dim i, j As Integer
conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source='c:\test.mdb'")
conn.Open()
cmd = CreateCommand(conn)
For i = 1 To 8760
cmd.Parameters(0).Value = New Date(2002, 1, 1).AddHours(i - 1)
For j = 1 To 40
cmd.Parameters(j).Value = Rnd()
Next
cmd.ExecuteNonQuery()
Next
conn.Close()
End Function
Public Function ExecuteSql()
Dim conn As SqlConnection
Dim cmd As IDbCommand
Dim i, j As Integer
conn = New SqlConnection("Data Source=COMPUTER\SQLServer; Database=testSQL; Integrated Security=SSPI")
conn.Open()
cmd = CreateCommand(conn)
For i = 1 To 8760
cmd.Parameters(0).Value = New Date(2002, 1, 1).AddHours(i - 1)
For j = 1 To 40
cmd.Parameters(j).Value = Rnd()
Next
cmd.ExecuteNonQuery()
Next
conn.Close()
End Function
Public Function ExecuteDAO()
Dim dbEng As DAO.DBEngineClass = New DAO.DBEngineClass()
Dim wk As DAO.Workspace = dbEng.Workspaces(0)
Dim db As DAO.Database = wk.OpenDatabase("C:\test.mdb")
Dim rs As DAO.Recordset = db.OpenRecordset("Test")
Dim i, j As Integer
For i = 1 To 8760
rs.AddNew()
rs.Fields(0).Value = New Date(2002, 1, 1).AddHours(i - 1)
For j = 1 To 40
rs.Fields(j).Value = Rnd()
Next
rs.Update()
Next
rs.Close()
db.Close()
End Function
Public Function CreateCommand(ByVal conn As IDbConnection) As IDbCommand
Dim cmd As IDbCommand = conn.CreateCommand()
Dim param As IDbDataParameter
param = cmd.CreateParameter()
param.ParameterName = "@obs"
param.DbType = DbType.DateTime
cmd.Parameters.Add(param)
Dim cmdText As String = "INSERT INTO Test (Observation"
Dim cmdTextParams As String = "@obs"
Dim scen As Integer
For scen = 1 To 40
param = cmd.CreateParameter()
param.ParameterName = "@val" & scen
param.DbType = DbType.Double
cmd.Parameters.Add(param)
cmdText &= ", Val" & scen
cmdTextParams &= ", @val" & scen
Next
cmdText &= ") VALUES (" & cmdTextParams & ")"
cmd.CommandText = cmdText
cmd.Prepare()
Return cmd
End Function
End Module
|
|
|
|
|
I am using InstallShield Developer 7.04 in order to distribute my application. My application is a maintenance application based on MSAccess. Now I want to delete some rows and add some others in one table. Can that be done using InstallShield and if yes how?
Thanks,
Spiros Prantalos
|
|
|
|