15,896,726 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by abdujalilc (Top 13 by date)
abdujalilc
23-Aug-17 23:53pm
View
It was a small account. The rows have variable expense criteria(ex. food, transport, phone, water, gas, electricity). In another table(id, date, expenses, summ, comment) these are used as limited static column options for expenses. As a summary I need a table which describes monthly expenses in a selected year. In this table the expense criteria are column names.
abdujalilc
8-Aug-16 3:56am
View
I am using C#.
abdujalilc
5-Aug-16 7:09am
View
Thanks it worked. Is it possible now to retrieve and save the loaded image in Image control to DB? Please with some examples.
abdujalilc
5-Aug-16 6:15am
View
Thanks, good explanation. If I want that selected image to be shown in Image control, can you show me some example codes as a reference?
abdujalilc
23-Oct-15 12:05pm
View
Problem solved . I couldn't finish this project without your help. I appreciate, thanks.
abdujalilc
23-Oct-15 2:44am
View
Hi friend, first I bind images to datagrid, then I select an image from datagrid and insert that selected image to the same database. I just simplified my real project in order to be understandable. So is my purpose achievable?
abdujalilc
22-Oct-15 14:09pm
View
Thanks a lot for your help again.
My wpf and C# codes are given below:
<window x:class="PupilReg.MainWindow"
="" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="Binding To Ado.net" height="644.351" width="674.234" fontsize="15" fontweight="Bold" resizemode="CanResizeWithGrip">
<grid>
<datagrid name="dataGrid1" height="565" width="435" autogeneratecolumns="False" margin="188,10,43,38">
<datagrid.itembindinggroup>
<bindinggroup>
<datagrid.columns>
<datagridtextcolumn header="Image_ID" binding="{Binding Path=Image_ID}" width="80">
<datagridtemplatecolumn header="Image_BLOB" width="200" isreadonly="True">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<Image Source="{Binding Path=Image_BLOB}" Width="160" Height="160" />
<Button x:Name="InsertImage" Content="Insert" Click="InsertImage_Click" Margin="31,39,583,541"/>
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace PupilReg
{
public partial class MainWindow : Window
{
string constr = "Data Source=localhost;port=3306;Initial Catalog=test;User Id=root;password=2525";
public MainWindow()
{
InitializeComponent();
BindGrid1();
}
private void BindGrid1()
{
MySqlConnection con = new MySqlConnection(constr);
MySqlCommand cmd = new MySqlCommand("SELECT * FROM images", con);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
dataGrid1.ItemsSource = dt.DefaultView;
}
private void InsertImage_Click(object sender, RoutedEventArgs e)
{
{
DataRowView SelectedRowValue = (DataRowView)dataGrid1.SelectedValue;
byte[] ImageBytes = (byte[])SelectedRowValue.Row.ItemArray[0];
MySqlConnection objConnection = new MySqlConnection(constr);
string CommandText = "INSERT INTO images (Image) VALUES (@ImageSource)";
MySqlCommand objCommand = new MySqlCommand(CommandText, objConnection);
objCommand.Parameters.Add("@ImageSource", MySqlDbType.Blob, ImageBytes.Length).Value = ImageBytes;
objConnection.Open();
objCommand.ExecuteNonQuery();
objConnection.Close();
}
}
}
}
abdujalilc
22-Oct-15 14:04pm
View
Thanks a lot for your help again.
My wpf and C# codes are given below:
<window x:class="PupilReg.MainWindow"
="" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="Binding To Ado.net" height="644.351" width="674.234" fontsize="15" fontweight="Bold" resizemode="CanResizeWithGrip">
<grid>
<datagrid name="dataGrid1" height="565" width="435" autogeneratecolumns="False" margin="188,10,43,38">
<datagrid.itembindinggroup>
<bindinggroup>
<datagrid.columns>
<datagridtextcolumn header="Image_ID" binding="{Binding Path=Image_ID}" width="80">
<datagridtemplatecolumn header="Image_BLOB" width="200" isreadonly="True">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<Image Source="{Binding Path=Image_BLOB}" Width="160" Height="160" />
<Button x:Name="InsertImage" Content="Insert" Click="InsertImage_Click" Margin="31,39,583,541"/>
C# is the following:
<window x:class="PupilReg.MainWindow"
="" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="Binding To Ado.net" height="644.351" width="674.234" fontsize="15" fontweight="Bold" resizemode="CanResizeWithGrip">
<grid>
<datagrid name="dataGrid1" height="565" width="435" autogeneratecolumns="False" margin="188,10,43,38">
<datagrid.itembindinggroup>
<bindinggroup>
<datagrid.columns>
<datagridtextcolumn header="Image_ID" binding="{Binding Path=Image_ID}" width="80">
<datagridtemplatecolumn header="Image_BLOB" width="200" isreadonly="True">
<datagridtemplatecolumn.celltemplate>
<datatemplate>
<Image Source="{Binding Path=Image_BLOB}" Width="160" Height="160" />
<Button x:Name="InsertImage" Content="Insert" Click="InsertImage_Click" Margin="31,39,583,541"/>
C# is the following:
using MySql.Data.MySqlClient;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace PupilReg
{
public partial class MainWindow : Window
{
string constr = "Data Source=localhost;port=3306;Initial Catalog=test;User Id=root;password=2525";
public MainWindow()
{
InitializeComponent();
BindGrid1();
}
private void BindGrid1()
{
MySqlConnection con = new MySqlConnection(constr);
MySqlCommand cmd = new MySqlCommand("SELECT * FROM images", con);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
dataGrid1.ItemsSource = dt.DefaultView;
}
private void InsertImage_Click(object sender, RoutedEventArgs e)
{
{
DataRowView SelectedRowValue = (DataRowView)dataGrid1.Selecte
abdujalilc
20-Oct-15 10:22am
View
ImageBytes=(byte[])Selected.RowValue.Row.ItemArray[0];--->
Null reference exception was unhandled.
Object reference not set to an instance of an object. How can I solve this one?
abdujalilc
20-Oct-15 8:27am
View
Thanks for your help . There is a tiny problem I have. It says "The name 'objImgBytes' does not exist in the current context ".
abdujalilc
19-Oct-15 12:00pm
View
It's blob.
abdujalilc
19-Oct-15 4:13am
View
private void BindGrid1()
{
MySqlConnection con = new MySqlConnection(constr);
MySqlCommand cmd = new MySqlCommand("SELECT Image FROM images)", con);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
dataGrid1.ItemsSource = dt.DefaultView;
}
abdujalilc
19-Oct-15 1:45am
View
Example code would be much appreciated if possible. As I am new on wpf. Thanks.
Show More