SqlCommand myCommand = new SqlCommand(sqlCreateDBQuery, tmpConn);
MessageBox.Show("Database has been created successfully!", "Create Database", MessageBoxButtons.OK, MessageBoxIcon.Information);
catch (System.Exception ex)
MessageBox.Show(ex.ToString(), "Create Database", MessageBoxButtons.OK, MessageBoxIcon.Information);
But it cause exception on 'tmpConn.Open()', and the message is:
An attempt to attach an auto-named database for file D:\y\2\TestDB_Data.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
How can I change the connection string and sqlCreateDBQuery to create a database file successfully?
Change the file names in the CREATE DATABASE statement so they use different file names to the one in your original connection string. You use AttachDbFilename='D:\y\2\TestDB_Data.mdf' in the connection string, then try to create a database file of the same name.
I'm an optoholic - my glass is always half full of vodka.
We have like 150 SQL Server Packages with around 20 jobs that run everyday in our Organization, for some reason some jobs are not running. What I need to do find out which Jobs ran successfully, which Jobs failed , which Jobs haven't started at all, if Job is failed then find out which steps are failed and inform to the corresponding persons with Email, for Email I wrote an Application, but I am trying to find out the ways to check the status of the Jobs, any suggestion, code snippet or even link helps me a lot.
Its little urgent, please help me - thanks in advance.
"There is already enough hatred in the world lets spread love, compassion and affection."
I can't tell if mysql clustering could be a solution(I am thinking about galera or xtradb clustering). But my biggest problem is about the unstable internet connection.
Actually it is planned as multi-tenant setup with a single online mysql server and the tenant is separated by schema, and a tenant can also have their own local database on their location.
But I want to solve this problem first.
For example I have a tenant, but this tenant has a multiple collocation, and want to sync the data on every location and also on the online server.
They can read/write on the first, second, etc collocation server using a desktop app(respective to their location) and they can also read/write on the online server using a mobile app.
Now my problem is how could I sync them, when internet is available? So data written and updated on the first location will propagate to other server, on the online server on the second server and so on, and vice-versa.
Well I had a simple table that contained 2 contact records, in which I was able to do a join and get the 2 contacts to send emails to.
Th entire program was based in this everywhere
Then the customer wanted to be able to do 3, 4 and 5 contacts to send emails to, So I said OK to make it unlimited.
I created a new table with 1 contact record.
So now I have an invoice that is a single record, and a list of contacts that can be multiple.
I forgot about the double record if my join has 2 contacts, so that's out the window.
I have no clue what would be the best solution, perhaps start again on the design; maybe someone can point me in the right direction here.
My last resort may be loading all the contacts in a 2nd query, and using linq to match and populate.
<pre>queryString += _
" UNION ALL " & _
" SELECT " & _
" h.FINVNO " & _
", h.FCUSTNO " & _
", h.FCOMPANY " & _
", h.FSALESPN " & _
", h.FSHIPVIA " & _
", h.FORDDATE " & _
", h.FSHIPDATE " & _
", h.FNTAXAMT " & _
", (SELECT a.FADDR1 FROM ARCUS01.dbf a WHERE h.FCUSTNO = a.FCUSTNO) AS FADDR1 " & _
", (SELECT j.FPRINT FROM ARCEMJN.dbf j WHERE h.FINVNO = j.FINVNO) AS FPRINT " & _
", (SELECT j.FSENT FROM ARCEMJN.dbf j WHERE h.FINVNO = j.FINVNO) AS FSENT " & _
", (SELECT p.FBATCH FROM ARPRINT.dbf p WHERE h.FINVNO = p.FINVNO) AS FBATCH " & _
", (SELECT ce.FID, ce.FCUSTNO, ce.FCHECK, ce.FNAME, ce.FEMAIL FROM ARCEM02.dbf ce WHERE FCUSTNO = h.FCUSTNO) AS CONTACTS " & _" FROM ARINV01H.dbf h " & _
" WHERE h.FSHIPDATE = @startDate "
Here, I started using List to return the records, so I can do further processing
I made a model with the contacts as a list. I'm in uncharted waters here, and I'm not sure if I do get the SQl to work, that I can populate the contacts using this method.
I've created a flash animation clip, Username & password also set that file. now i want to integrate this File with my another java application,with giving this files to link & never ask flash file password, because I've only one UI for java application only
DROP PROCEDURE IF EXISTS tgc.UpdateCustomerBalance;
CREATE PROCEDURE tgc.`UpdateCustomerBalance`(customerId varchar(50), cost Decimal(8,2))
UPDATE Customers SET Balance = Balance - cost WHERE CustomerId = customerId;
with the following C# code:
using (var context = new Db_Entities())
object parameters =
new MySql.Data.MySqlClient.MySqlParameter("@customerId", customerId),
new MySql.Data.MySqlClient.MySqlParameter("@cost", cost)
await context.Database.ExecuteSqlCommandAsync("UpdateCustomerBalance @customerId,@cost", parameters);
catch (Exception e)
But I receive the error:
"Message": "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UpdateCustomerBalance 'xyz',0.03' at line 1",
Can anyone help shed some light on this? I've tried all sort and am now seeing tunnel vision.
The query work but i get error message if I try to save as a view - the errors talk about duplicate names ?
b.event_id AS a,
b.user_ID AS a,
b.date AS a,
b.Time AS a
FROM quadrantids2017 AS a
JOIN quadrantids2017 AS b
WHERE a.`date` = b.`date`
AND a.user_ID != b.user_ID
AND time_to_sec(a.`Time`) - time_to_sec(b.`Time`) BETWEEN -30 AND 30
Every column in a view needs to have a unique name. You've given all four columns the alias "a", which is obviously not unique.
Just remove the four As a alias from the SELECT part of the query, and you should be able to create a view.
quadrantids2017 AS a
JOIN quadrantids2017 AS b
a.`date` = b.`date`
a.user_ID != b.user_ID
time_to_sec(a.`Time`) - time_to_sec(b.`Time`) BETWEEN -30 AND30
Alternatively, give each column a unique alias.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer