|
hi all
i have created a stored procedure in sql server with two parameters
todate and from date
i want to generate a crystal report using above procedure
i have no idea about what to write in add command of report for
executing a stored procedure with parameters
if anyone have any idea pls suggest
|
|
|
|
|
Look around on google for examples
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Hi,
I hav a code for import data from excel to sql server. This code used to import data totally. That is, already some data in excel imported the whole data to sql server.The code is,
Dim excelConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;"""
Dim connection As OleDbConnection = New OleDbConnection(excelConnectionString)
Try
Dim command As OleDbCommand = New OleDbCommand("Select ID,Data FROM [Sheet1$]", connection)
connection.Open()
Dim dr As OleDbDataReader = command.ExecuteReader
Try
Dim sqlConnectionString As String
'= WebConfigurationManager.ConnectionStrings("CampaignEnterpriseConnectionString").ConnectionString
sqlConnectionString = "Data Source=rafik-vzi7iicz1\sa;Initial Catalog=Excel;Integrated Security=True"
Dim con As SqlConnection
con = New SqlConnection(sqlConnectionString)
Dim bulkCopy As SqlBulkCopy = New SqlBulkCopy(sqlConnectionString)
Try
bulkCopy.DestinationTableName = "Exceldata"
bulkCopy.WriteToServer(dr)
Finally
CType(bulkCopy, IDisposable).Dispose()
End Try
Finally
CType(dr, IDisposable).Dispose()
End Try
Catch ex As Exception
Finally
CType(connection, IDisposable).Dispose()
End Try
MsgBox("imported successfully", MsgBoxStyle.Information)
The code is working perfectly.
My problem is, i need to import the data by character wise. That is, suppose i typing some word in excel, the word automatically saved in sql server by character wise.
Any idea Plz tell me.
Suggestions also appreciate.
Plz help me.
|
|
|
|
|
kamarudeen wrote: i need to import the data by character wise.
What do you mean by "character wise"??
|
|
|
|
|
character wise means cell by cell. That is the data imported to sql server cell by cell.
For ex:
excel sheet:
CELL 1 CELL 2 CELL 3 CELL 4
DATA: VELU RAMU RAMU KATHER
KAMAR SIDDIQ SADIQ SEERR
this is sample data. I need to import data every cell by cell.
|
|
|
|
|
hello
I want to know why this error "Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException'.
now i'm tracing why this error occurr, but can't find yet.
if someone has experience with this error, please help me and send me message.
phoopwint
flowerppk
|
|
|
|
|
AxHost is a class that hosts ActiveX (COM) components on your form. You have a COM-based control that you added to your form that is misbehaving.
|
|
|
|
|
Dear programmers,
Can anyone give me the code to make the data displayed in the datagrid or HFlexGrid editable and then save that in the database.
I urgently need that for my project in the job.
Thanks one and all
Keshav Singh Developer in C++ and VB
|
|
|
|
|
Keshav Singh Sunwar wrote: urgently
Very impolite.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi Paul,
Keshav here to whom you replied a few hours back. I m extremely sorry for the words I used in my message.
Actually I need to do the same at any cost before this weekend, that was the reason 4 the message.
I am trying to make datagrid editable by inserting a textbox on the click event of the Flexgrid for each cell clicked.
I hope it will work out.
Thnx for the message
keshav
Keshav Singh Developer in C++ and VB
|
|
|
|
|
I think Dave's reply is the better one
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
This[^] is about the best information you're going to get on creating an editable MSFlexGrid.
|
|
|
|
|
I am using VB 2005. trying to create wilcard parameter search. I don't know how to connect variamble Name to the one using in SQL statements.
SQL lines in Query builder:
SELECT ID, Ime, Priimek, [Službeni telefon], [Službeni GSM], [Domaci telefon], [Privatni GSM], [Elektronska pošta], [Domaci naslov]<br />
FROM SLUŽBA<br />
WHERE (Priimek LIKE '%' & '@NAME' & '%')
And in Form2 I have this code inside button1 object:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<br />
<br />
Dim NAME As String<br />
<br />
NAME = TextBox1.Text<br />
<br />
<br />
Try<br />
Me.SLUŽBATableAdapter.FillBy2(Me.TelefonskiImenikDataSet.SLUŽBA, NAME)<br />
Catch ex As System.Exception<br />
System.Windows.Forms.MessageBox.Show(ex.Message)<br />
End Try<br />
End Sub
can anyone tell me what is wrong here and correct the code, please.I've b een researching a lot and don't find a proper solution. Please Help. The builder doesn't report any error but the button doesn't do a query parameter wildcard search. Variable NAME is underlined with green waveline.It says too many arguments to function FillBy2.
|
|
|
|
|
BOREC wrote: '@NAME'
Remove the apostrophes around the parameter. The apostrophes tell SQL Server to expect a string literal value.
|
|
|
|
|
Could it be that wildcard parameter search doesn't work because I use Express edition version of the program?
When I remove the apostrophes the wizard alerts: Erros in WHERE clause near '@'. Unable to parse query text.
I tried a lot ways to create a FillBy2 function with apropriate SQL statements and then call the function in Button_click subroutine but it doesn't work. Has anyone done this at home or office?
Can someone post the whole code so I can analyze it. Comments very welcome.
Bye
|
|
|
|
|
You can pad the value entered by user with '%' before sending it as parameter, ie
1. User type in 'abc'
2. In your code, pad the value to '%abc%'
3. Set the padded value to the parameter.
So your selection will just be:
WHERE (Priimek LIKE @NAME)
By the way, your original selection statement always search for '%@NAME%' <-- no longer a parameter.
|
|
|
|
|
I understand this. But what puzzles me is that when I create parameter search using this SQL statement
SELECT...
FROM ...
WHERE ( Priimek = ?) the wizard automaticaly creates a function FillBy
the wizard automaticaly creates a function FillBy(Priimek) With a variable Priimek which I can use in this statement
Me.SLUŽBATableAdapter.FillBy2(Me.TelefonskiImenikDataSet.SLUŽBA, PriimekToolStripTextBox.Text)
But when I create a function with SQL statement
WHERE (Priimek LIKE @NAME)
I get a function with no parameter. The wizard simply puts it out as FillBy2()<-no parameter.
I want to create a parametrized wildcard search. When I write "Klaj" out of "Klajnšek" Lastname in TextBox1 I want that the program displays all records with letters "klaj" in LastName like "Klajnšek" or like "Priklajdorin". I hope you understand.
Thank you for help
modified on Thursday, December 27, 2007 7:55:50 AM
|
|
|
|
|
BOREC wrote: Could it be that wildcard parameter search doesn't work because I use Express edition version of the program?
No. Parameters are such a basic feature that the Express edition includes it.
BOREC wrote: When I remove the apostrophes the wizard alerts: Erros in WHERE clause near '@'. Unable to parse query text.
Wizards!?! Why aren't you writing the code yourself. Wizards won't help you, they hinder you because they only allow limited functionality and produce inefficient code (they do produce correct code though which is their primary aim)
|
|
|
|
|
I would need a good example code to do that, otherwise I can't do it. I am not that good.
|
|
|
|
|
If no one has mentioned to this you before, please give your message titles meaning.
|
|
|
|
|
Daj cijeli kod.
HINT: nemoj radit sa drag & drop nacinom, odnosno koristiti kakve carobnjake kako bi izveo SQL query. Ako hoceš bit dobar programer, onda piši sve iz koda. npr. ja bih to bolje ovako izveo
dim dbconn as new system.data.sqlclient.sqlconnection(connectionstring)
dim query as string
dim sqlKomanda as system.data.sqlclient.sqlcommand()
dim reader as system.data.sqlclient.sqldataReader()
query = " taj tvoj query"
sqlcommand = new sqlcommand(query,dbconn)
reader = sqlcommand.executereader()
i sada manipuliraš reader objektom i iz njega izvlaciš podatke...
itd...
Nadam se da sam bio od pomoci.
Pozdrav iz Bjelovara.
|
|
|
|
|
I'm kinda thinkin' you want it to look like this:
BOREC wrote: WHERE (Priimek LIKE '''%' & @NAME & '%''')
Tom
|
|
|
|
|
hi there,
i hav a prob that i have resource file in 3 diff languages
first one is English second one is German and third one is French
when app runs it automaticaly loads the English resources as i m using an English OS and also it is the first table, i want to load resources other than English i.e. the german and french which ever is desired,
One way of doin this is maintain a language off set and put all the three diff lang resources in single file it works fine but i want it the other way i.e. maintaing diff tables for diff lang resources and loading the desired one.
Any suggstions will do a great favour to me
Thanks & Regards
Faisal Ch Mehmood
i m faisal
|
|
|
|
|
|
Please, Help me if anybody can!!!!!
I want to generate own Report from my project,not from Crystal report Software.
I used following control in VB6 to generate Crystal.
CRViewer.This control can get Crystal Report Viewer component.
Like this VB6 code,i am using this control in VB.Net,
Friend WithEvents crvReport As CRVIEWERLib.CRViewer
Me.crvReport = New CRVIEWERLib.CRViewer
And my form has Preview command button to preview own report from this form.If user click this Preview button ,user can preview his own report.For
this ,i am using this code in cmdPreview_Click().
Call frmpReport.ShowReport(m_astrType, m_strColumn, m_aintWidth, m_astrFSource, blnSave)
,but my project face with problem in this line.
Call frmpReport.ShowReport(m_astrType, m_strColumn, m_aintWidth, m_astrFSource, blnSave)
Error Message is
Unable to cast COM object of type 'CRVIEWERLib.CRViewerClass' to interface type
I will waiting for your answer.THANKS For ur Answer.
|
|
|
|