View Full Version : به چه شکل یکdata setرا در crystal reportتعریف می کنیم.
minooei
شنبه 20 اسفند 1384, 13:37 عصر
--------------------------------------------------------------------------------
به چه شکل یکdata setرا در crystal reportتعریف می کنیم.
منتظر جواب هستم
meh_secure
شنبه 20 اسفند 1384, 23:53 عصر
شما ابتدا یه فایل از نوع دیتاست به پروژه ات اضافه کن.
بعد تو طراحی گزارشت از اون دیتاست استفاده کن.
فعلا تا اینجا برو تا نحوه ی مقدار دهی دیتاست .....
meh_secure
شنبه 20 اسفند 1384, 23:53 عصر
در ضمن تاپیک هات رو یک بار بفرست.
minooei
سه شنبه 23 اسفند 1384, 08:20 صبح
Private Sub BTNSEARCH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNSEARCH.Click
' Variable Defination
Dim strQuery As String = String.Empty
Dim strWhere As String = String.Empty
Dim strLikeStart As String = String.Empty
Dim strLikeEnd As String = String.Empty
Dim strSearchCatalog As String = String.Empty
Dim strSearchDrawing As String = String.Empty
Dim strAndDrowing As String
Dim strAndCatalog As String
Dim strAnd As String
Dim strSearchPicture As String = String.Empty
Dim strSearchMobDrawing As String = String.Empty
Dim strSearchDocument As String = String.Empty
Dim strAndPicture As String
Dim strAndMobDrawing As String
Dim strAndDocument As String
dsSearch.Clear()
If TXTCATALOGUE.Text <> "" Then
If TXTCATALOGUE.Text.IndexOf("*") = 0 Then
strLikeStart = "%"
End If
If TXTCATALOGUE.Text.IndexOf("*") = TXTCATALOGUE.Text.Length - 1 Then
strLikeEnd = "%"
End If
If (TXTCATALOGUE.Text.IndexOf("*") = 0) And (TXTCATALOGUE.Text.IndexOf("*", 1) = TXTCATALOGUE.Text.Length - 1) Then
strLikeStart = "%"
strLikeEnd = "%"
End If
If (TXTCATALOGUE.Text.IndexOf("*") = -1) Then
strLikeStart = ""
strLikeEnd = ""
End If
TXTCATALOGUE.Text = TXTCATALOGUE.Text.Replace("*", "")
strWhereCaltalog = "CatalogueNumber LIKE '" + strLikeStart + TXTCATALOGUE.Text.ToString + strLikeEnd + "'"
strSearchCatalog = " ItemNo =( Select ItemNo from Catalogueitemccl Where " & strWhereCaltalog & " ) "
End If
If txtdocument.Text <> "" Then
If txtdocument.Text.IndexOf("*") = 0 Then
strLikeStart = "%"
End If
If txtdocument.Text.IndexOf("*") = txtdocument.Text.Length - 1 Then
strLikeEnd = "%"
End If
If (txtdocument.Text.IndexOf("*") = 0) And (txtdocument.Text.IndexOf("*", 1) = txtdocument.Text.Length - 1) Then
strLikeStart = "%"
strLikeEnd = "%"
End If
If (txtdocument.Text.IndexOf("*") = -1) Then
strLikeStart = ""
strLikeEnd = ""
End If
txtdocument.Text = txtdocument.Text.Replace("*", "")
strwheredocument = "DOCUMENT LIKE '" + strLikeStart + txtdocument.Text.ToString + strLikeEnd + "'"
strSearchDocument = " ItemNo =( Select ItemNo from DOCITEMCCL Where " & strwheredocument & " ) "
End If
If TXTMOBRAKEHDRAWING.Text <> "" Then
If TXTMOBRAKEHDRAWING.Text.IndexOf("*") = 0 Then
strLikeStart = "%"
End If
If TXTMOBRAKEHDRAWING.Text.IndexOf("*") = TXTMOBRAKEHDRAWING.Text.Length - 1 Then
strLikeEnd = "%"
End If
If (TXTMOBRAKEHDRAWING.Text.IndexOf("*") = 0) And (TXTMOBRAKEHDRAWING.Text.IndexOf("*", 1) = TXTMOBRAKEHDRAWING.Text.Length - 1) Then
strLikeStart = "%"
strLikeEnd = "%"
End If
If (TXTMOBRAKEHDRAWING.Text.IndexOf("*") = -1) Then
strLikeStart = ""
strLikeEnd = ""
End If
TXTMOBRAKEHDRAWING.Text = TXTMOBRAKEHDRAWING.Text.Replace("*", "")
strwheremobdrawing = "MobarakehDrawingNumber LIKE '" + strLikeStart + TXTMOBRAKEHDRAWING.Text.ToString + strLikeEnd + "'"
strSearchMobDrawing = " ItemNo =( Select ItemNo from MobItemccl Where " & strwheremobdrawing & " ) "
End If
If Txtpicture.Text <> "" Then
If Txtpicture.Text.IndexOf("*") = 0 Then
strLikeStart = "%"
End If
If Txtpicture.Text.IndexOf("*") = Txtpicture.Text.Length - 1 Then
strLikeEnd = "%"
End If
If (Txtpicture.Text.IndexOf("*") = 0) And (Txtpicture.Text.IndexOf("*", 1) = Txtpicture.Text.Length - 1) Then
strLikeStart = "%"
strLikeEnd = "%"
End If
If (Txtpicture.Text.IndexOf("*") = -1) Then
strLikeStart = ""
strLikeEnd = ""
End If
Txtpicture.Text = Txtpicture.Text.Replace("*", "")
strwherepictuer = "PictureNumber LIKE '" + strLikeStart + Txtpicture.Text.ToString + strLikeEnd + "'"
strSearchPicture = " ItemNo =( Select ItemNo from PictureItemccl Where " & strwherepictuer & " ) "
End If
If TXTITEMNO.Text <> "" Then
If TXTITEMNO.Text.IndexOf("*") = 0 Then
strLikeStart = "%"
End If
If TXTITEMNO.Text.IndexOf("*") = TXTITEMNO.Text.Length - 1 Then
strLikeEnd = "%"
End If
If (TXTITEMNO.Text.IndexOf("*") = 0) And (TXTITEMNO.Text.IndexOf("*", 1) = TXTCATALOGUE.Text.Length - 1) Then
strLikeStart = "%"
strLikeEnd = "%"
End If
If (TXTITEMNO.Text.IndexOf("*") = -1) Then
strLikeStart = ""
strLikeEnd = ""
End If
TXTITEMNO.Text = TXTITEMNO.Text.Replace("*", "")
If strWhere <> String.Empty Then
strWhere &= " And "
End If
strWhere &= "ITEMCCL.ITEMNO LIKE '" + strLikeStart + TXTITEMNO.Text.ToString + strLikeEnd + "'"
End If
If TXTDRAWING.Text <> "" Then
If TXTDRAWING.Text.IndexOf("*") = 0 Then
strLikeStart = "%"
End If
If TXTDRAWING.Text.IndexOf("*") = TXTDRAWING.Text.Length - 1 Then
strLikeEnd = "%"
End If
If (TXTDRAWING.Text.IndexOf("*") = 0) And (TXTDRAWING.Text.IndexOf("*", 1) = TXTDRAWING.Text.Length - 1) Then
strLikeStart = "%"
strLikeEnd = "%"
End If
If (TXTDRAWING.Text.IndexOf("*") = -1) Then
strLikeStart = ""
strLikeEnd = ""
End If
TXTDRAWING.Text = TXTDRAWING.Text.Replace("*", "")
strWhereDrawing = "DrawingNumber LIKE '" + strLikeStart + TXTDRAWING.Text.ToString + strLikeEnd + "'"
strSearchDrawing = " ItemNo =( Select ItemNo from DrawingNumberItemccl Where " & strWhereDrawing & " ) "
End If
If TXTMANUFACTURE.Text <> "" Then
If TXTMANUFACTURE.Text.IndexOf("*") = 0 Then
strLikeStart = "%"
End If
If TXTMANUFACTURE.Text.IndexOf("*") = TXTMANUFACTURE.Text.Length - 1 Then
strLikeEnd = "%"
End If
If (TXTMANUFACTURE.Text.IndexOf("*") = 0) And (TXTMANUFACTURE.Text.IndexOf("*", 1) = TXTMANUFACTURE.Text.Length - 1) Then
strLikeStart = "%"
strLikeEnd = "%"
End If
If (TXTMANUFACTURE.Text.IndexOf("*") = -1) Then
strLikeStart = ""
strLikeEnd = ""
End If
TXTMANUFACTURE.Text = TXTMANUFACTURE.Text.Replace("*", "")
If strWhere <> String.Empty Then
strWhere &= " And "
End If
strWhere &= "MANUFACTUERNAME LIKE '" + strLikeStart + TXTMANUFACTURE.Text.ToString + strLikeEnd + "'"
End If
If TXTITEMNAME.Text <> "" Then
If TXTITEMNAME.Text.IndexOf("*") = 0 Then
strLikeStart = "%"
End If
If TXTITEMNAME.Text.IndexOf("*") = TXTITEMNAME.Text.Length - 1 Then
strLikeEnd = "%"
End If
If (TXTITEMNAME.Text.IndexOf("*") = 0) And (TXTITEMNAME.Text.IndexOf("*", 1) = TXTITEMNAME.Text.Length - 1) Then
strLikeStart = "%"
strLikeEnd = "%"
End If
If (TXTITEMNAME.Text.IndexOf("*") = -1) Then
strLikeStart = ""
strLikeEnd = ""
End If
TXTITEMNAME.Text = TXTITEMNAME.Text.Replace("*", "")
If strWhere <> String.Empty Then
strWhere &= " And "
End If
strWhere &= "ITEMNAME LIKE '" + strLikeStart + TXTITEMNAME.Text.ToString + strLikeEnd + "'"
End If
If strSearchCatalog = String.Empty Then
strAndCatalog = ""
Else
If strWhere = String.Empty Then
strAndCatalog = ""
Else
strAndCatalog = " AND "
End If
End If
If strSearchDrawing = String.Empty Then
strAndDrowing = ""
Else
If strWhere = String.Empty And strSearchCatalog = String.Empty Then
strAndDrowing = ""
Else
strAndDrowing = " AND "
End If
End If
If strSearchPicture = String.Empty Then
strAndPicture = ""
Else
If strWhere = String.Empty And strSearchCatalog = String.Empty And strSearchDrawing = String.Empty Then
strAndPicture = ""
Else
strAndPicture = " AND "
End If
End If
If strSearchDocument = String.Empty Then
strAndDocument = ""
Else
If strWhere = String.Empty And strSearchCatalog = String.Empty And strSearchDrawing = String.Empty And strSearchPicture = String.Empty Then
strAndDocument = ""
Else
strAndDocument = " AND "
End If
End If
If strSearchMobDrawing = String.Empty Then
strAndMobDrawing = ""
Else
If strWhere = String.Empty And strSearchCatalog = String.Empty And strSearchDocument = String.Empty And strSearchDrawing = String.Empty And strSearchPicture = String.Empty Then
strAndMobDrawing = ""
Else
strAndMobDrawing = " AND "
End If
End If
strQuery = "SELECT ItemCCL.ItemNO,ITEMNAME,MANUFACTUERNAME,WEIGHT,REV" _
& " FROM ItemCCL Where " _
& strWhere _
& strAndCatalog & strSearchCatalog _
& strAndDrowing & strSearchDrawing _
& strAndPicture & strSearchPicture _
& strAndDocument & strSearchDocument _
& strAndMobDrawing & strSearchMobDrawing _
& " order by ItemCCL.ItemNO "
Try
dsSearch = Testdb2.Selectrep(strQuery)
Catch ex As Exception
MsgBox(ex.Message)
End Try
If dsSearch.Tables(0).Rows.Count = 0 Then
Label7.Visible = True
Else
DataGrid1.Visible = True
GetData()
MakeReport.Enabled = True
End If
End Sub
حال می خواهم dssarchرادر crystal reportوارد کنم خواهش میکنم کمکم کنید خیلی عجله دارم.از شما خیلی متشکرم
meh_secure
سه شنبه 23 اسفند 1384, 23:50 عصر
من کاری به کوئری ات ندارم. شما یک فایل از نوع دیتاست به پروژه ات اضافه کن. فیلدهایی که می خوای تو گزارشت باشه رو به این دیتا ست اضافه کن.
گزارشت رو با این دیتاست بساز. ADO.net(توی کریستال). موقع لود فرم گزارش یک دیتاست ایجاد کن(از طریق کد) که دقیقا شبیه به اون دیتاستی که توی گزارشت هست باشه با این تفاوت که شرط هات متفاوته. بعدشم از طریق کد زیر دیتاست رو به گزارش بایند کن.
myRpt.datasource.setdatasource myDataSet
minooei
چهارشنبه 24 اسفند 1384, 13:06 عصر
خیلی ممنون از راهنمایی شما ولی یعنی چه( دیتاست ایجاد کن(از طریق کد) که دقیقا شبیه به اون دیتاستی که توی گزارشت هست باشه با این تفاوت که شرط هات متفاوته)
منتظر جوابم ببخشید:خجالت:
meh_secure
شنبه 27 اسفند 1384, 22:05 عصر
چی بگم. واضح تر از این؟
شبیه بودن یعنی اینکه جدول هایی که از طریق دیتاست به گزارشت داده بودید باید دقیقا مشابه دیتاست جدیدی باشه که بهش می فرستی. شرط متفاوت هم شما می تونی Filter در نظر بگیری یا Where.
alireza6282
جمعه 11 فروردین 1385, 10:12 صبح
با سلام . من دقیقا همین کار رو انجام می دم و هیچ خطایی هم دریافت نمی کنم ولی با داده ها در هنگام گزارش دهی نمایش داده نمی شود و ستون ها خالی هستند میشه بفرمایید چرا ؟ اگه ممکنه یه مثال کوچیک بزنید یا می خواهید من کدم رو بذارم . من تمامی مراحل بالا رو انجام دادم .
meh_secure
شنبه 12 فروردین 1385, 15:18 عصر
شما درست عمل کردید. منتها باید یک دیتاست به گزارشتون بدید که Fill شده باشه چون دیتاست فعلی خالی است و فقط برای مشخص شدن فیلدهای گزارش استفاده میشه.
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.