I can access Microsoft Access database via ODBC on Windows 2000 using
C++. Now, I would like to use the SAME piece of code to access MS SQL
on Windows. Can I achieve this without any modification to my existing
codes?
Then, I would like to use the SAME piece of codes to access Oracle
on Windows? Is it possible?
Thanks in advance!
I am applying hourly differential backup to the backup server from production with the following command. This command makes the database on standby server into read only mode.
RESTORE DATABASE ARSYSTEM FROM DISK = 'E:SQL backup from productionsql_full_backup' WITH MOVE 'arsystem' TO 'd:ardataarsystem.mdf' , MOVE 'arsystem_log' TO 'D:ARLOGARsystem' , STANDBY = 'E:SQL backup from productionSQL daily diff back up'
Now I want to run a command which will put the database in write mode. I have created a job which would make the datbase Write mode. This job runs successfully sometimes and fails sometimes. I need to ensure that the job always succeeds. When it fails, how do I troubleshoot and what is the possible fix?
Thanks in advance.
The error message is
Cannot apply the backup on device 'E:SQL backup from productionSQL daily diff back up' to database 'ARSYSTEM'. [SQLSTATE 42000] (Error 3136) RESTORE DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.
The steps for the job are as follows with the failing step highlighted in bold.
copy /y "\172.31.9.12Remedy BackupackupSQL backupsql_full_backup" "E:SQL backup from productionsql_full_backup"
copy /y "\172.31.9.12Remedy BackupackupSQL backupSQL daily diff back up" "E:SQL backup from productionSQL daily diff back up"
xp_cmdshell 'net stop "bmc remedy action request system server"'
exec rp_kill_db_processes 'ARSYSTEM'
RESTORE DATABASE ARSYSTEM
FROM DISK = 'E:SQL backup from productionsql_full_backup'
WITH
MOVE 'arsystem' TO 'd:ardataarsystem.mdf' ,
MOVE 'arsystem_log' TO 'D:ARLOGARsystem' ,
NORECOVERY
Failing step
RESTORE DATABASE ARSYSTEM
FROM DISK = 'E:SQL backup from productionSQL daily diff back up'
WITH
MOVE 'arsystem' TO 'd:ardataarsystem.mdf' ,
MOVE 'arsystem_log' TO 'D:ARLOGARsystem' ,
RECOVERY
xp_cmdshell 'del /f "E:SQL backup from productionsql_full_backup"'
xp_cmdshell 'del /f "E:SQL backup from productionsql daily diff back up"'
xp_cmdshell 'net start "bmc remedy action request system server"'
I have scheduled the following hourly diffential restore job too which never fails.
RESTORE DATABASE ARSYSTEM FROM DISK = 'E:SQL backup from productionsql_full_backup' WITH MOVE 'arsystem' TO 'd:ardataarsystem.mdf' , MOVE 'arsystem_log' TO 'D:ARLOGARsystem' , STANDBY = 'E:SQL backup from productionSQL daily diff back up' EXEC MASTER..XP_CMDSHELL 'del /f "E:SQL backup from productionSQL daily diff back up"'
I am not sure I understand the problem I am causing, but I am a beginner!
Here's the situation: I have a table located on MS SQL server database number 1. Said table, which we'll call WIDGET_PRICES, is accessed regularly by my existing source code and has no problems.
At some point, I decide to move operations to MS SQL database number 2 and do a very simple database copy of WIDGET_PRICES from database 1 to database 2 using the Microsoft SQL Server Management Studio.
The end result, inevitably, is that my source code can no longer access the very same table as it is located on the new database server. The code hasn't changed, it's still trying to access WIDGET_PRICES as always. And, from what I see on my screen through Management Studio, WIDGET_PRICES appears just fine.
An example error is the one I just got:
Microsoft OLE DB Provider for SQL Server error '80040e37'
Invalid object name 'YB_ITEMS'.
/yardbark/tampabay/header.asp, line 27
The only clue is that while my transferred tables often look named like "database1.WIDGET_PRICES on database 1, they wind up looking like database2.WIDGET_PRICES on dabase 2.
I include a little more detail and screenshots of the tables in questions at this web page.
Hejsan! I have a page with with diffrent short news. They are in a Database (MS SQL) and now they saving all after the other, but I should want to only have 3 news in the DB, and when I write in a new short news it should be saved over one of them older new witch is in the databaseHow can I do that? Anyone who nows to write that in the code?mvh Sanne My code looks like this now:<script runat="server"> Sub Page_Load(sender As Object, e As EventArgs) Dim myConnection As SqlConnection Dim myCommand As SqlDataAdapter ' Create a connection to the "pubs" SQL database located on the ' local computer. myConnection = New SqlConnection("server=xxxxx;UID=xxxx;PWD=xxxx;Initial Catalog=xxx;") ' Connect to the SQL database using a SQL SELECT query to get all ' the data from the "notistabell" table. myCommand = New SqlDataAdapter("SELECT * FROM notiser ORDER BY ID Desc", myConnection) ' Create and fill a DataSet. Dim ds As DataSet = new DataSet() myCommand.Fill(ds) ' Bind MyDataList to the DataSet. MyDataList is the ID for ' the DataList control in the HTML section of the page. MyDataList.DataSource = ds MyDataList.DataBind() End Sub </script>
OKAY I have one table "Data" with about 7 million records. Now I want to create the following output table. THe range (1 to 15) can always change in the "data" table. How would I write a script to do this?
I am receving this error: Failed to open the connection: [Database Vendor Code: 17 ], from .Net 2003/C# to Crystal Report XI with SQL Server 2000 has backend database.
Is there a security permission that has been overlooked?
//Get Table inf from report DB = reportDocument..Database; tables = DB.Tables;
//Looping through all the tables in CR and apply connection info for(int i = 0; i < tables.Count; i++) { table = tables[ i ]; tableLogOnInfo = table.LogOnInfo; tableLogOnInfo.ConnectionInfo = connectionInfo; table.ApplyLogOnInfo(tableLogOnInfo);
what is the simple way of writing code for the connection with sql server in c# .net could any one provideme with the code for the same ism not been able to understand the funda of using class for the connection purpose if any one knows plz let me know i am waiting
Hi, I want to write a script in Vb.net and use that script in rs.exe utility..but i am not able to understand where should i have to write the script in Vb.net for reporting services. Why i am writing the script code is???
In Report manger,i am trying to restrict folders and reports for particular persons only like manger can see all the reports,advisor can view only related reports. this can do by using item level security in report manger by creating roles and we can add the users in to the role. but that was not happenning..planning for another way to implement the scenario.
I came to know that we can write scripting in vb.net and we can run thru rs.exe utility in SSRS.
1.But where can i write the vb.net script? 2.How to migrate that code to report manager? 3.Can we debug that code? 4.How to use SOAP API in RS?
Pls reply back..this one i have to do with in one day..
hi there, i have been wrestling with this for quite a while, as in my other post http://forums.asp.net/t/1194975.aspx, what someone advised me was to put in try catch blocks ot see whats going on, problem is i have never really done it whit this kinda thing before, and i was wondering if someone could point me in the right direction.
For example where would i put the try catch block in here, to show me if its not working public int getLocationID(int ProductID, int StockLoc) { // Gets the LocationID (Shelf ID?) for the stock column and product id // passed // The SQL will look Something like: string strSQL; strSQL = "SELECT " + " location" + StockLoc + " " + "FROM " + " tbl_stock_part_multi_location " + "WHERE " + " stock_id = " + ProductID;string sConnectionString = "Data Source=xxxxx;Initial Catalog=xxxx;User ID=xxxx;Password=xxxxx"; SqlConnection objConnGetLocationID = new SqlConnection(sConnectionString);SqlCommand sqlCmdGetLocationID = new SqlCommand(strSQL, objConnGetLocationID); objConnGetLocationID.Open();int intLocation = Convert.ToInt32(sqlCmdGetLocationID.ExecuteScalar()); return intLocation; }
It is a initialization of the two dimensional array DETAILED-VOUCHER(Temporary Variable) which consists of the account number for that account number different group of people say as (teachers, state police etc) have different 12 kinds of amounts such as (DEATH-AMT, PAYEE-AMTetc ) for every account number. SUB (Temporary Variable) is used as subscript whose value will be incremented by 1 after initializing current position by zero in order to initialize all 12 positions in array.
LOP-ZERO-2. MOVE ZEROS TO CNT-V (1 SUB). MOVE ZEROS TO AMT-V (1 SUB). ADD 1 TO SUB. IF SUB NOT GREATER THAN 12 GO TO LOP-ZERO-2.
MOVE 2 TO SUB.
LOP-ZERO-3. MOVE CNTS (1) TO CNTS (sub). ADD 1 TO SUB. IF SUB NOT > 13 GO TO LOP-ZERO-3.
MOVE '401.21' TO ACC-NO-V (1). ---------- This are the hotcode values MOVE '410.01' TO ACC-NO-V (2). MOVE '410.02' TO ACC-NO-V (3). MOVE '410.03' TO ACC-NO-V (4). MOVE '410.04' TO ACC-NO-V (5). MOVE '410.06' TO ACC-NO-V (6). MOVE '410.05' TO ACC-NO-V (7). MOVE '411.01' TO ACC-NO-V (8). MOVE '411.02' TO ACC-NO-V (9). MOVE '331.01' TO ACC-NO-V (10). MOVE '212.19' TO ACC-NO-V (11). MOVE '212.22' TO ACC-NO-V (12).
MOVE ZEROS TO XYZ-S (1). MOVE ZEROS TO MNO-B (1). MOVE ALL '9' TO A-KEY MOVE 01 TO D-X. MOVE 1 TO SYS-Y
Please give suggest me how to write logic in the sql server. I want to how to write two dimensional array loop in the sql server.
hi, I need to run a batch file in specific time of the week. can anyone show me the code to run a batch file with both ways: window nt schedualer and ms sql server task manger.... I do appreciate your help
Can I write a dll(or share the same code) that works on both Mobile device and pc? Since we are using compact edition, we are hoping we can write some common module with the same code that could works on both mobile device and pc platform. I noticed the reference is the same, System.Data.SqlServerCe.dll 3.0.
Another question is, we already have a module for SQLCE2.0, with .net CF1.0. Now, we will start to use compact edition, should we just update on the 1.0 one, or we have to write a different one based on .net CF2.0? Can I use compact edition in CF1.0 dll?
I am TRYING to write code to combine two tables and then return the maximum value of one table, but SQL Server keeps telling me that the column is not valid.... I have added attached screenshots to show that it IS a valid column, so I cannot figure out what is the retarded issue!!
Hi GuysOff late, I've grown with programming that requires more than a number of tables that has foreign keys with other tables' primary keys. It takes a really cumbersome coding to retrieve the code from another table with the other table having foreign keys. My question is, how do we program VS 2005 such that it does all the retrieval of the data from the database instead of us writing the code all by ourself?Is it really good database technique to bend the normalcy rules and have one to two columns having redundant data?Can anyone tell me how to write code that retrieves the foreign key data when the data from the other table is called?Thanks
I have a database that has been working in MS Access 97 for a couple of years. I just moved the tables up to our SQL Server (7.0) and now I get "Write Conflict" errors when I try to update certain records. The table has a unique primary key and I have upgraded my MDAC to 2.50. Nothing seems to help. The records that get the Write Conflict tend to be ones that are the newer ones in the database. Not all records have this problem. I can update the records by going to Enterprise Manager and typing data directly in the tables. The detail on the error message says "This record has been changed by another user since you started editing it." I am the only one using the database. Any ideas?
I am converting an MS-Access DB to SQL-Server, and one of the queries I'm converting uses the VB Val() function in the ORDER BY clause. Is there any T-SQL function that can mimic this? CAST and CONVERT return errors because some of the data is non-numeric. The column I am ordering is a varchar(5) with ID number 'ZZ0001', 'CC0002', 'AA0003' etc . I would like the dataset to be sorted by number only :
I'm trying to code a query in Access that finds rows w/ duplicate "ContactKeys" then finds duplicate "AddressLine1s" out of the list of duplicate "ContactKeys." (I tried subqueries but it was really slow)
I am trying to create a new table with only duplicate ContactKey rows, and then I wanted to use that table to pick out the duplicate AddressLine1 rows.
Code:
SELECT * INTO dupContactKeys FROM Contacts WHERE ContactKey IN ( SELECT ContactKey FROM Contacts GROUP BY ContactKey HAVING COUNT(*) > 1)
SELECT * FROM dupContactKeys WHERE ContactKey IN ( SELECT AddressLine1, Zip FROM Contacts GROUP BY AddressLine1, Zip HAVING COUNT(*) > 1) ORDER BY ContactKey, TypeKey;
drop table dupContactKeys
This of course doesn't work. Please help, as I am going slightly mad!
Hi,I'm accessing a pair of databases with ASP/ADO,and using stored procedures on the first access.The first access works OK - everything gets writtento where it's supposed to be.On attempting to write to a pair of database tablesin the second database (second access attempt),the server crashes, as does the app, and I get the following error:--------------------------------------------------------------------Server Error in '/Webfolder01' Application.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Data.SqlClient.SqlException: A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The pipe has been ended.)--------------------------------------------------------------------After this, I have to go into the services panel and restart SQL 2005.This doesn't happen if I use small test data sets in the first access,and I can comment out the second access attempt, and the first accessexecutes just fine with both the large and small data sets,so I'm thinking that this has something to do with synchronisation:Perhaps the second attempt is being made before the server is ready.Is there something that I need to do to make certain that SQL 2005is ready to receive data?I'm using SqlBulkCopy with both accesses, but I don't see how thatcould be a problem.--------------------------------------------------------------------[SqlException (0x80131904): A transport-level error has occurred when receiving results from the server. (provider: Shared Memory Provider, error: 0 - The pipe has been ended.)] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857370 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734982 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error) +556 System.Data.SqlClient.TdsParserStateObject.ReadSni(DbAsyncResult asyncResult, TdsParserStateObject stateObj) +164 System.Data.SqlClient.TdsParserStateObject.ReadPacket(Int32 bytesExpected) +34 System.Data.SqlClient.TdsParserStateObject.ReadBuffer() +30 System.Data.SqlClient.TdsParserStateObject.ReadByte() +17 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +59 System.Data.SqlClient.SqlBulkCopy.WriteToServerInternal() +1327 System.Data.SqlClient.SqlBulkCopy.WriteRowSourceToServer (Int32 columnCount) +916 System.Data.SqlClient.SqlBulkCopy.WriteToServer(DataTable table, DataRowState rowState) +176 System.Data.SqlClient.SqlBulkCopy.WriteToServer(DataTable table) +6 Database_control.DB_ctrl_class.load_datatable_to_DB_table(DB_ref_class src_table) in i:Virtual WebfoldersDBctrl.cs:978--------------------------------------------------------------------THANK YOU VERY MUCH!!!
Hello does anyone know how to convert this access code to sql. Also is there a program out there that will do it for you.
IIf([Ceridian]![UnionIndicator]="U" And [YearsService]>=3,[HealthBenefits]![medplan.Bi-WeeklyURBio-Rad]*26,[HealthBenefits]![medplan.Bi-WeeklyBio-Rad]*26) AS MedicalCostER, IIf([Ceridian]![UnionIndicator]="U" And [YearsService]>=3,[medplan]![Bi-WeeklyUREE]*26,[medplan]![Bi-WeeklyEE]*26) AS MEdicalCostEE
I am trying to find ways around the limitation of not being able to resize columns based on the text input. I am dynamically setting what values a column is getting from my query. I am wondering if I can access the table (and thus, the columns) from within the custom code.
For example:
Public Function Whynot() As Integer Report.table1.TableColumn1.Width = .... table1.TableColumn.Width = .... Return 0 End Function
Neither of these seem to work, anyone else have any ideas?
Hello all, I need to prevent all users (other than sysadmin/dbo) privs to access the database code (SP/Views/UDF). What would be the best way to achieve that? TIA
I have <asp:SqlDataSource> in aspx page that is being used by an updateable GridView. However, there are a couple fields in the dataset that contain filenames that I want to access directly in code and place them into some image tags on the page. This line should give me access to the dataset but how to I access the fields? Dim myDataSource As DataView = DirectCast(SqlDataSourceGridView.[Select](DataSourceSelectArguments.Empty), DataView) When the SqlDataSource is a DataReader I would access it with the code below but since this SqlDataSource is a DataSet I can't access it with this code.If myDataSource.Read Then If Convert.IsDBNull(myDataSource("CusAgentPhoto")) Then ImageAgent.ImageUrl = "/photos/nophoto.gif" Else ImageAgent.ImageUrl = AgentImagePath & myDataSource("CusAgentPhoto").ToString End If If Convert.IsDBNull(myDataSource("CusCompanyLogo")) Then ImageCompany.ImageUrl = "/photos/nophoto.gif" Else ImageCompany.ImageUrl = OfficeImagePath & myDataSource("CusCompanyLogo").ToString End IfEnd If What would be the correct way to get at the DataSet fields that contain the filenames?
We are migrating an access97 database to sql server7.0. there are queries in access which need to be made into tsql queries.And what are the steps to convert access97 to sql7.0 and how do i migrate memo fields to sql7. Is there some method to convert or tool that does that...any help is welcome and thanks in advance.
I have an application in C# in which i have few events like download,Import and I have written all the code for that and its working fine but I have to schedule these processes so that I need not to run it manually daily. I am trying to write an Integration services package through which I could handle the required event, without rewriting the whole code.
For setting different languages on the column haeders i need to access a dataset from a custom code function call. I want to pass a parameter to the function that will allow me to find a specific item in the dataset - like a lookup function. I cannot find a way to get access to the entire dataset and to iterate through its components.
Is there any solution? Every hint will be helpful!
Hi to all, I'm writting code that needs to pass data returned by a SqlDataSource object to another object (user control to graph data) Query in SqlDataSource object is OK, I've seen data returned by it at a GridView Object but I need to pass that data to an user control that needs a reference to the table that has the data ... What would be the code that do that task ?? I'm new to develop web applications... using Visual Web Developer Express 2008 Help in advance