Code Snippet How to extract Cell Numbers from long strings
This was a query raised by one of a forum members at another site, where he had a worksheet filled with random numbers, and I have already answered that query [at my post here](https://vbacoder1962.wordpress.com/2019/07/15/extracting-cell-phone-numbers-from-random-strings-of-variable-length/). You may go through that post and read the logic behind the code. ![vbacoder_Code_20190715.jpg](/attachments/large/4/160efbe4e4d0a8400d04653a6e420c7b.jpg)
|+1 forum 0|
Code Snippet Simple database access wrapper class
I'm sure I've mentioned this type of wrapper class for accessing databases in a provider-agnostic manner before, but never posted a functional implementation. So here it is. Questions, comments, and suggestions are welcome as always. :)
|+3 forum 4|
Code Snippet 2 dimensional string array to SQLite database table
Earlier I posted a snippet which showed [how to create a 2 dimensional string array from an SQLite database table](https://www.daniweb.com/software-development/csharp/code/494083/sqlite-database-table-to-2-dimensional-string-array-). This snippet is the reverse, if you will, where we create an SQLite database table from a 2d string array. It should be noted that this code has it's limitations, as is, and should be used where the strings in array are less than 128 characters long. This can easily be amended to accommodate strings of any length, but I felt it was beyond the scope of this snippet. This code demonstrates *one way* to create a transaction which greatly …
|+0 forum 5|
Code Snippet Safe and SIMPLE database inserts and other queries
Here is a simple way to insert into a database that isn't much harder than using string concatenation - which we all know is very dangerous due to SQL injection attacks. Put the code snippet into `database.php`. Now, in a script handling a form post, such as `post_reply.php`: <?php require_once("database.php"); // Get session and post data to insert - no need for mysql_real_escape_string or other escaping // (Note: Passwords should still go through password_hash() or crypt() though!) $member_id = $_SESSION['member_id']; $response_to = isset($_POST['response_to']) ? $_POST['response_to'] : (isset($_GET['response_to']) ? $_GET['response_to'] : ''); $subject = isset($_POST['subject']) ? $_POST['subject'] : ''; $post = …
|+4 forum 6|
Code Snippet How to read an Excel spreadsheet using ADODB
If your Excel spreadsheet is laid out as regular columns and rows with a header row that identifies the columns then this code will allow you to read the data using ADODB the same way you would read records from a database table. To try this code 1. Create a new project 1. Add a ListBox control named ListBox1 1. Add a project reference to **adodb** 1. Replace the project code with the snippet code To create a test Excel spreadsheet just download the attached **test.zip** and unzip it. The file, **test.xls** contains a table of authors, books and a …
|+1 forum 2|
Code Snippet Insert a file as binary data into a database
Several people have asked about storing binary data in a database. I coded up an example today that uses an ADODB.Stream to copy the binary data but after some fiddling I found a more direct way. If you are using MS SQL Server, the easiest way I have found is to let the DBMS do all the dirty work. This example uses SqlClient but as long as the DBMS supports the operation, the same query should work under ADO or OleDB on other platforms. The example uses a database with two columns.
|+0 forum 0|
Code Snippet Compacting MS Access in Code
Hi! This is my submission for code snippet contest. I also posted this code to help other members on how they can use compact & repair their MS Access Database within Visual Basic 6.0. You also need to add Microsoft Jet and Replication 2.6 in your project reference. To use, add the snippet in Module; Once you have added it to the module just call CompactAccess with database location and its password like this; Call CompactAccess("C:\Database.mdb", "12345") I also attached a sample project on how you can use it, just check it out. [Click Here](http://www.daniweb.com/images/attachments/1/Compacting_Database.zip) Please note that the database …
|+3 forum 2|
Code Snippet Code To Read Image From Database
This is the simple code to read an image from the database.
|+2 forum 1|
Code Snippet Data from DataBase to/into dgv using DataTable
Code shows how to bind the data from a database`s table to dataTable and populate dataGridView with it. And then how to pass the modified (or not) data from dataGridView back to dataBase`s table.
|+0 forum 3|
Code Snippet Python Database Server?
Hello, I've been working on this self-made database. What do you think about it? What features should I create for it? I'd also like to get help in a select method, because I don't have the foggiest idea how it could be done. And what about making it a database server? What does a database server exactly do? The usage is like this: >>> db = Database('databases/family') >>> table = db.get_table('general') >>> for row in table: print row ['Line', 'First_name', 'Last_name', 'Age', 'Nickname'] [0, 'Levente', 'Sandor', 15, 'Levi'] [1, 'Tamas', 'Karvalics', 15, 'Tomi'] [2, 'Matyas', 'Sandor', 17, 'Matyi'] [3, 'Peter', …
|+0 forum 0|