Component to sdf file - Microsoft SQL Server database lazarus / 16-Databases ---------------------------------------------------------------------- Mi-Ki · 2023-01-30 15:05 Hi. I can't do much in lazarus. Can you help me please? I've bought a piece of software that stores its database in an .sdf file How to open a Lazarus database? Need to open a database and load a table VAZENI Here's the database **://leteckaposta.cz/486686910 Thank you very much. ---------------------------------------------------------------------- wp · 2023-01-30 15:19 There is a TSDFDataset. Go to "Package" > "Install/uninstall packages" and make sure that package SDFLaz is installed. Cannot download your database file. Why don't you zip it and attach it to your post? (If it's too large remove some lines - sdf is a text file). ---------------------------------------------------------------------- Mi-Ki · 2023-01-30 15:50 I'm sorry. I almost deleted everything and has more tha 500 KB. ---------------------------------------------------------------------- wp · 2023-01-30 15:55 No - this not the kind of SDF file that I mean since it is not a text file - forget my previous post. Which application did you use to write this file? **s://filext.com/file-extension/SDF - Microsoft SQL Server Compact? ---------------------------------------------------------------------- Mi-Ki · 2023-01-30 16:07 I bought the software that it stores in this file. I opened the database in SDF Viewer 1.13. **s://sdf-viewer.software.informer.com/St%C3%A1hnout/ **s://postimg.cc/c6dtkS5f Can't Lazarus use for this file? ---------------------------------------------------------------------- wp · 2023-01-30 16:56 Quote from: Mi-Ki on January 30, 2023, 05:07:14 pmCan't Lazarus use for this file?  I tried to set up a connection with MSSQLConnection but failed due to a missing dll. But wait a bit, I am not an expert with MSSQL, maybe somebody else knows a solution. ---------------------------------------------------------------------- Thaddy · 2023-01-30 16:56 https://fileinfo.com/extension/sdf Which one? Note the microsoft version is deprecated for 10 years.... ---------------------------------------------------------------------- Mi-Ki · 2023-01-30 17:02 Thaddy - I know, but we have the software that uses it. They need to add data. ---------------------------------------------------------------------- Sieben · 2023-01-30 17:11 This here site lists 4 free tools to view and even edit MS SQL Server CE *.sdf files. Since it dates from 2017 these might still be available. ---------------------------------------------------------------------- Thaddy · 2023-01-30 17:13 Better to convert the lot to sqlite, ahum, maybe firebird, or standard database format. In that case your bought library should help over an e.g. odbc connection and on a microsoft system. ---------------------------------------------------------------------- Thaddy · 2023-01-30 17:14 Quote from: Sieben on January 30, 2023, 06:11:55 pmThis here site lists 4 free tools to view and even edit *.sdf files. Since it dates from 2017 these might still be available. sdf files lead to confusion because the extension name is not very carefully chosen. Such files are likely to represent different things. More or less like the imaginary Thaddy's Xenophobic Trauma format.. (txt extension would be nice....)    And no, no driver for that. Maybe you can read it but I won't let you!! Go away... ---------------------------------------------------------------------- Mi-Ki · 2023-01-30 17:50 What is this? https://www.youtube.com/watch?v=pq2oCiJePHo ---------------------------------------------------------------------- Thaddy · 2023-01-30 17:58 Quote from: Mi-Ki on January 30, 2023, 06:50:33 pmWhat is this? **s://www.youtube.com/watch?v=pq2oCiJePHo NOT the Microsoft format but the Standard Database Format.... You really do not grasp it, do you? YOUR SDF is Microsoft specific. SDF is a text based format for the normal people. Also note the dead giveaway: MSSQL is never mentioned. ---------------------------------------------------------------------- Mi-Ki · 2023-01-30 18:07 You confuse the truth, I don't understand. I've never done with the database before. So is it unsolvable through Lazarus? ---------------------------------------------------------------------- paweld · 2023-01-30 18:40 Devart's SDAC component suite has the ability to connect to SQL Server Compact - these are paid components:  https://www.devart.com/sdac/ ---------------------------------------------------------------------- TRon · 2023-01-30 23:13 Quote from: Mi-Ki on January 30, 2023, 07:07:43 pmYou confuse the truth, That seem to happen when meddling with things that one has no experience with  QuoteI don't understand. I've never done with the database before. Tbh that was a bit obvious as you also linked to a youtube video that does absolutely nothing with SDF / SQL server compact. The video only shows that Lazarus is capable of developing database applications in this particular video by connecting to a firebird database. You wrote: Quote from: Mi-Ki on January 30, 2023, 04:05:45 pmI've bought a piece of software that stores its database in an .sdf file You seem to have purchased software that stores its data in a proprietary database format. According to the wiki the origin of that database format is EOL and has been so for many years (https://en.wikipedia.org/wiki/SQL_Server_Compact). Try to see if your software is able to store/save/export the database to another format that /is/ supported by Free Pascal/Lazarus and repeat the quest(ion). QuoteSo is it unsolvable through Lazarus? See paweld's answer. Personally I would not bother so would advise against it (but I have not a clue about your restrictions/freedoms). ---------------------------------------------------------------------- paweld · 2023-01-31 08:29 You can also connect via OleDB, using the ComObj unit. An example is attached. The system must have Microsoft SQL Server Compact 4 installed: https://www.microsoft.com/en-us/download/details.aspx?id=30709 ---------------------------------------------------------------------- Mi-Ki · 2023-01-31 09:34 paweld - Thank you very much, it works.  Need to work with the table VAZENI There is Stringgrid. When I add another line, how to save? ---------------------------------------------------------------------- paweld · 2023-01-31 14:01 I have expanded to include the ability to add records - attached. ---------------------------------------------------------------------- Mi-Ki · 2023-01-31 15:59 Quote from: paweld on January 31, 2023, 03:01:46 pmI have expanded to include the ability to add records - attached. Thank you very much. ---------------------------------------------------------------------- paweld · 2023-01-31 19:00 In the previous version, there is a bug related to the formatting of the date when adding a record - the database accepts the format yyyy- mm-dd, so as in the system was different it threw an error. Attached is the new version, and below is just the modified function:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i function TForm2.ValueToSql(idx: Integer): String;var  cn: ShortString;  i, j: Integer;  fs: TFormatSettings;begin  fs.DecimalSeparator := '.';  fs.ShortDateFormat := 'yyyy/mm/dd';  fs.DateSeparator := '-';  fs.LongTimeFormat := 'hh:nn:ss';  fs.TimeSeparator := ':';  Result := '';  case Form1.tablestruct[idx]._type of    'int', 'bigint', 'numeric', 'decimal', 'float': cn := 'TFloatSpinEdit';    'varchar', 'char', 'nvarchar', 'nchar': cn := 'TEdit';    'text', 'ntext': cn := 'TMemo';    'date', 'time', 'datetime': cn := 'TDateTimePicker';  end;  j := -1;  for i := 0 to Panel1.ComponentCount - 1 do  begin    if Panel1.Components[i].ClassName = cn then    begin      if Panel1.Components[i].Tag = idx then      begin        j := i;        break;      end;    end;  end;  case Form1.tablestruct[idx]._type of  'int', 'bigint', 'numeric', 'decimal', 'float': Result := FormatFloat('0.######', TFloatSpinEdit(Panel1.Components[j]).Value, fs);    'varchar', 'char', 'nvarchar', 'nchar': Result := '''' + StringReplace(TEdit(Panel1.Components[j]).Text, '''', '''''', [rfReplaceAll]) + '''';    'text', 'ntext': Result := '''' + StringReplace(TMemo(Panel1.Components[j]).Lines.Text, '''', '''''', [rfReplaceAll]) + '''';    'date': Result := '''' + DateToStr(TDateTimePicker(Panel1.Components[j]).Date, fs) + '''';    'time': Result := '''' + TimeToStr(TDateTimePicker(Panel1.Components[j]).Time, fs) + '''';    'datetime': Result := '''' + DateTimeToStr(TDateTimePicker(Panel1.Components[j]).DateTime, fs) + '''';  end;end;