|
If it is one time...
1. You can save the file as CSV. Do a "save as" and then pick the 'type' via the drop down.
2. Then as noted you can use sqlloader.
If you must automate this to do it over and over then there are other problems you did not touch on like how you know there is a new file and how to recognize an update versus new.
But at any rate it is possible to read an excel file via an "ODBC" driver. I believe this is still possible, once you track down the driver. This would with very simple Excel files.
|
|
|
|
|
Why do you need to convert to CSV, why not just read the data from the Excel file and send it direct to the database? And why have you posted the question twice with slightly different details?
|
|
|
|
|
Hi All,
I have a new product must be cloud over an internet and we need to choose the best database for this issue from the pricing and performance issues.
we need to know the best for this, is it the Microsoft SQL Server or the PostgreSQL.
(SQL Server VS PostgreSQL).
also I need the best tutorial and videos about the PostgreSQL database.
Please Help me ASAP.
Thank You All
|
|
|
|
|
Performance from any database will vary greatly based on what the actual use case is. If you're looking to warehouse data the "best" product will be very different than if you need a speedy cache, for instance.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
Based on the requirements you posted (none) the best one is going to be the one that your or the other developers have the most experience with.
|
|
|
|
|
Hi
I want write a code that overwrite from a folder of DB to a other folder and this code run as windows services,How do I write this code?
Thanks Very Much
Marzi
|
|
|
|
|
I would start with writing a code that runs as windows service and can do what you need.
|
|
|
|
|
While exchanging referrals and asked to write bitcoint to where money was transferred what do i write?am using my name but am not its not found on database please help
|
|
|
|
|
What are you talking about?
|
|
|
|
|
Am an online worker and i need to buy some referrals since have attracted non but am unable since i dont know what to fill when requested to state a bitcoin to where money was transferred
|
|
|
|
|
This site is not associated with such things: they are a deliberate distortion of statistics designed to fool users into thinking a site is more popular than it is.
Go to google, and try there: Buying of referrals - Google Search[^]
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
For many years, I have been successfully using MS Access VBA to import data from a Sybase ASE server through direct queries. Several years ago, it was necessary to locate and install new drivers when I upgraded from XP to Win7 64-bit. All was working well until I got a new Win10 PC. I fought with installing the same drivers I used with the Win7 machine but was finally able to make a successful connection. The recordsets that are returned contain empty character fields. Numeric and date fields display fine.
For example,
SELECT 123 FROM someTable Returns: 123
SELECT '123' FROM someTable Returns:
I tried different values for the CharacterSet parameter in the connection string but it made no difference. I also googled... There was some information regarding empty strings for formatting purposes but none that I found that would explain the above results.I can't figure out why only char fields are affected. I would expect all or nothing if it were a driver issue but the same drivers work in Win7.
Any thoughts??
|
|
|
|
|
Presuming you are not hiding/eating errors then it has nothing to do with connections nor general calling semantics.
However it very likely has to do with HOW you are calling it which you did not specify.
But I will note that in the first case I would expect a caller to be defined to expect a numeric value.
While the second would require a caller to expect a textual value and probably a 'CHAR' type with a specific size (3 or greater) specified.
|
|
|
|
|
The call for the Win 10 machine is below. This is the same as it is in the Win 7 machine. Sensitive information masked
Public Sub Doit()
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
Dim sSql As String
Dim sConnStr As String
sSql = "SELECT '123' FROM someTable"
sConnStr = "Provider=ASEOLEDB.1;Password=[password];Persist Security Info=True;User ID=[user];Data Source=[ip_address]:[port];Initial Catalog=xyz"
sConnStr = Replace(sConnStr, "[password]", "******")
sConnStr = Replace(sConnStr, "[user]", "******")
sConnStr = Replace(sConnStr, "[ip_address]", "*******")
sConnStr = Replace(sConnStr, "[port]", "******")
cn.Open sConnStr
rs.Open sSql, cn
Debug.Print rs.GetString
End Sub
|
|
|
|
|
Well, It appears as if it is a driver compatibility issue. I downloaded the Devart driver and string fields are returned as expected. Further research shows that there are newer drivers in the SDK but it is no longer available to common folks like myself. I suppose I will have to weigh the cost of a third party driver versus redesigning and distributing the app. Unless anyone knows an alternate location for ASE drivers compatible with Windows 10??
|
|
|
|
|
This issue has been resolved. After days of searching, I found an evaluation version of SAP Adaptive Server Enterprise 16. This package contained updated drivers that work with Windows 10.
|
|
|
|
|
First please excuse my bad english. As you can asume it's not my native language....
I'm using SQL Server Compact Edition and Visual Basic 2015 and i did a few programs with SQL-Databas-Access so far.
This programs where quite simple. They read the whole table at the beginning into a Dataset, work with this and write it back when the application is closed.
Now i need some more secure access and found some information that it's better to cut the database Acces from the gui and the business logic - all three called layer.
What i need or what i'm asking for is a small sample application with just one Database-Table - let's name it "Persons" with the fiels "Person-Id" (the key), "Person-Firstname", "Person-Lastname", "Person-DateOfBirth".
GUI should have separate fields for each of the given fields.
Acces should be Record by Record. (Input the Id, if exist show the related data in the gui, if not show empty fields, with a save button to change values / write the changes to tha database.)
Business logic may just check if the DateOfBirth is in a range from 1.1.1900 to 31.12.2099.
How should my class look like to build all three layers?
Maybe this is to much described in detail...
I just want to see a class representing all 3 layers to handle some persons data ...
Is this possible? Whould someone be so kind? This would help me so much in understanding!!!
Thank you very, very much!
|
|
|
|
|
|
I think you have misunderstood a little how the three-tier model works.
You don't need to re-invent your model for each tier. There are different approaches on how to handle this, but most modern approaches are based on the Model-View-Something(MV*) architecture (MVC, MVVM, MVP...there seem to be new ones daily).
Each of these map to the three-tier architecture in slightly different ways, but there are consistent points. A Model is a an object that is solely a data container. It should implement no business logic, and in your case will represent a single record from the database. It's basically just a data container.
The other consistent element is the View, or UI. Any UI interaction logic should live here, to include wiring for UI event handlers and any UI-specific logic. This is where it can become easy to get lost and break the pattern, but play with it a little and you'll start to get it.
The last part of the MV* architecture is how the business layer is implemented. Ideally, the business layer should server as an intermediary between the DAL and the UI, and depending on implementation there can be a varying level of success with that.
I suggest you have a look around at some resources regarding these patterns; there is a lot available. Which one you start with depends a lot on what sort of applications you are writing: web apps almost invariably fall to the MVC side while Windows desktop apps generally end up in an MVVM world. Just don't let yourself get confused by MVC.NET, that's a specific implementation from MicroSoft.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
I heared about MVC so far. This is what a mean. Sorry if i asked my question the wrong way.
My goal is a windows desktop app using win forms.
Of course a want to learn it from the basics but i wasn't able to find some tutorials about that and on the other hand i often lerned by having a closer look on an ready example...
Do you know a basic tutorial or example about mvc or mvvm?
Many, many thanks in advance.
|
|
|
|
|
Generally you're looking at MVVM then, which is more commonly associated with WPF, which may be the path you want to take. WinForms is a supposedly deprecated technology and MS may remove support for it "someday", but WPF is still in wide use.
There are many, many examples and tutorials available on CP. Just searching the articles will give you a abundance of choice:
CP MVVM Search
You can likely safely ignore the articles that directly address specific controls and technologies until you get the gist.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
I gave you a link to a simple example/tutorial in my message above.
|
|
|
|
|
Yes, you did. Thank you very much. I will have a closer look tomorrow.
|
|
|
|
|
I am trying to improve my CTE knowledge and am stuck on a point that I am hoping that someone can help me with. I have not found this in the forum, so if you know of a post that covers this, please point me towards it.
Using the sample off the MS CTE page:
<pre lang="SQL">CREATE TABLE dbo.MyEmployees
(
EmployeeID smallint NOT NULL,
FirstName nvarchar(30) NOT NULL,
LastName nvarchar(40) NOT NULL,
Title nvarchar(50) NOT NULL,
DeptID smallint NOT NULL,
ManagerID int NULL,
CONSTRAINT PK_EmployeeID PRIMARY KEY CLUSTERED (EmployeeID ASC)
);
-- Populate the table with values.
INSERT INTO dbo.MyEmployees VALUES
(1, N'Ken', N'Sánchez', N'Chief Executive Officer',16,NULL)
,(273, N'Brian', N'Welcker', N'Vice President of Sales',3,1)
,(274, N'Stephen', N'Jiang', N'North American Sales Manager',3,273)
,(275, N'Michael', N'Blythe', N'Sales Representative',3,274)
,(276, N'Linda', N'Mitchell', N'Sales Representative',3,274)
,(285, N'Syed', N'Abbas', N'Pacific Sales Manager',3,273)
,(286, N'Lynn', N'Tsoflias', N'Sales Representative',3,285)
,(16, N'David',N'Bradley', N'Marketing Manager', 4, 273)
,(23, N'Mary', N'Gibson', N'Marketing Specialist', 4, 16);
WITH DirectReports (ManagerID, EmployeeID, Title, Level)
AS
(
-- Anchor member definition
SELECT e.ManagerID, e.EmployeeID, e.Title,
0 AS Level
FROM dbo.MyEmployees AS e
WHERE ManagerID IS NULL
UNION ALL
-- Recursive member definition
SELECT e.ManagerID, e.EmployeeID, e.Title,
Level + 1
FROM dbo.MyEmployees AS e
INNER JOIN DirectReports AS d
ON e.ManagerID = d.EmployeeID
)
-- Statement that executes the CTE
SELECT ManagerID, EmployeeID, Title, Level
FROM DirectReports
order by level, managerid
GO</pre>
Gives this, which I am pretty much understanding.
ManagerID EmployeeID Title Level
NULL 1 Chief Executive Officer 0
1 273 Vice President of Sales 1
273 16 Marketing Manager 2
273 274 North American Sales Manager 2
273 285 Pacific Sales Manager 2
16 23 Marketing Specialist 3
274 275 Sales Representative 3
274 276 Sales Representative 3
285 286 Sales Representative 3
What I would like to figure out is how to modify the query to group the data differently, in this example show a manager, then anyone who reports to them, then the next manager. It seems like a simple concept, but I will be damned if I have been able to figure it out.
ManagerID EmployeeID Title Level
NULL 1 Chief Executive Officer 0
1 273 Vice President of Sales 1
273 16 Marketing Manager 2
16 23 Marketing Specialist 3
273 274 North American Sales Manager 2
274 275 Sales Representative 3
274 276 Sales Representative 3
273 285 Pacific Sales Manager 2
285 286 Sales Representative 3
</pre>
Thanks for reading.
|
|
|
|
|
Something like this should work:
WITH DirectReports As
(
SELECT
e.ManagerID,
e.EmployeeID,
e.Title,
0 AS Level,
CAST(e.EmployeeID As varchar(max)) As Path
FROM
@T As e
WHERE
ManagerID IS NULL
UNION ALL
SELECT
e.ManagerID,
e.EmployeeID,
e.Title,
Level + 1,
Path + '/' + CAST(e.EmployeeID As varchar(max))
FROM
@T As e
INNER JOIN DirectReports As d
ON e.ManagerID = d.EmployeeID
)
SELECT
ManagerID,
EmployeeID,
Title,
Level,
Path
FROM
DirectReports
ORDER BY
Path
; Output:
ManagerID EmployeeID Title Level Path
NULL 1 Chief Executive Officer 0 1
1 273 Vice President of Sales 1 1/273
273 16 Marketing Manager 2 1/273/16
16 23 Marketing Specialist 3 1/273/16/23
273 274 North American Sales Manager 2 1/273/274
274 275 Sales Representative 3 1/273/274/275
274 276 Sales Representative 3 1/273/274/276
273 285 Pacific Sales Manager 2 1/273/285
285 286 Sales Representative 3 1/273/285/286
Alternatively, you could use the hierarchyid[^] type:
Tutorial: Using the hierarchyid Data Type | Microsoft Docs[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|