TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Searching crystal reports in C#
Pintoo Yadav
Apr 11
2015
Code
1.2
k
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
using
System.Data.OleDb;
namespace
SakshiHospital
{
public
partial
class
DebitRpt: Form
{
public
DebitRpt()
{
this
.AutoScaleDimensions =
new
System.Drawing.SizeF(6F, 13F);
this
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this
.ClientSize =
new
System.Drawing.Size(721, 439);
this
.Name =
"Cry_Report"
;
this
.Text =
"Cry_Report"
;
this
.Load +=
new
System.EventHandler(
this
.DebitRpt_Load);
this
.ResumeLayout(
false
);
this
.SuspendLayout();
InitializeComponent();
}
private
void
DebitRpt_Load(
object
sender, EventArgs e) {}
private
void
btnSearch_Click(
object
sender, EventArgs e)
{
try
{
// string bill_no = "B_00" + txtbillno.Text;
DataSet ds =
new
DataSet();
// con = new OleDbConnection(ConfigurationManager.ConnectionStrings["connect"].ConnectionString);
OleDbConnection con =
new
OleDbConnection(
"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=ClientMgmtDb1.accdb;"
);
con.Open();
OleDbDataAdapter da =
new
OleDbDataAdapter();
// if(txtbillno.Text.Trim().Length==0)
if
(txtdebitnote.Text !=
""
)
{
// MessageBox.Show("Enter Bill number");
da =
new
OleDbDataAdapter(
"select ID,NAME,Debit_Number,Date,Address,PO_Number,PO_Date,Narat,Quantity,Rate,Total_price,amount FROM Debit_Mst where Debit_Number='"
+ txtdebitnote.Text.Trim() +
"'"
, con);
}
da.Fill(ds,
"Debit"
);
if
(ds.Tables.Count > 0)
{
Debitrptcr cr =
new
Debitrptcr();
// Bill2 cr = new Bill2();
cr.SetDataSource(ds.Tables[0]);
this
.crystalReportViewer1.ReportSource = cr;
this
.crystalReportViewer1.Show();
//// }
}
con.Close();
}
catch
(OleDbException s)
{
MessageBox.Show(
"Server Problem..."
);
}
}
private
void
txtdebitnote_TextChanged(
object
sender, EventArgs e) {
txtdebitnote.BackColor = System.Drawing.Color.Aquamarine;
this
.AcceptButton = btnSearch;
}
}
}
C# Programming
.Net
Crystal report