
mcerk
Avatar/Signature-
Posts
78 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by mcerk
-
ok that helps a lot. I'll have to check if it works. tx
-
Ok. I want to create setup, that would silently install required dll's. I inserted this msms: VC User CRT71 RTL X86 ---.msm VC User STL71 RTL X86 ---.msm Crystal_regwiz2003.msm Crystal_Managed2003.msm Crystal_Database_Access2003_enu.msm Crystal_Database_Access2003.msm But if I Build this project, It allso creates user interface. How can I create a project that wouldn't ask me anything, but just install dll's in this msms. tx matej
-
Deleting from DataGrid (bound to dataset)
mcerk replied to mcerk's topic in Database / XML / Reporting
I can send SQL commands to dataset? using data reader? how? -
Hi. In vb6 you could convert date to integer very simple. (like in excell). Integer then represented day number (starting to count at 1.1.1900). So date 1.1.1900 was converted to integer 1, 2.1.1900 to integer 2, etc... Is there any avaliable function to convert date to integer (that would represent number of days)???? tx matej
-
OK. I want to delete rows from DataGrid. I'm doing it like this: Dim RowNumber as integer RowNumber = Me.BindingContext(DataSet.Table1).Position Me.DataSet.Table1.Rows(RowNumber).Delete So, row number 'Me.BindingContext(DataSet.Table1).Position' is marked for deletion (it alsso disapears from DataGrid). The row is deleted, when I update DataSet from DataAdapter. OK, It is all right through this point. But.... If I delete row nr. 8 (Me.BindingContext(DataSet.Table1).Position=8), then row nr. 9 gets number 8. And so on. I can not delete all rows using this method. So my question is. How can I define 'real' row number. ???? PS: I'm deleteing selected row (in datagrid) by pressing a button.
-
OK, I fugured solution: It doesn't metter what kind of datasource I use. I just have to change dropdownstyle property. ComboBox.DropDownStyle = ComboBoxStyle.DropDownList
-
hm... this is strange. If I insert Date.Now into SQL database 'datestamp field', and then try to retrieve it with reader like Lebel1.text = Format(myReader("field1"), "dd.mm.yy") I dont get correct value. Days and years are ok, but months are complete wrong. What is the problem? (mm can allso be bigger than 12 like 59 or something). I'm confused....
-
Hi I have combobox. I have bound it to datatable (or to arraylist. Does it make a difference?) 'combo with DataTable datasource Me.ComboBox1.DataSource = myDataTable Me.ComboBox1.DisplayMember = "DisplayMember" Me.ComboBox1.ValueMember = "ValueMember" 'combo with ArrayList datasource Me.ComboBox2.DataSource = myArrayList Me.ComboBox2.DisplayMember = "DisplayMember" Me.ComboBox2.ValueMember = "ValueMember" my problem is, that I can still write in this combo (i can write a value/text that is not listed in dropdown list. I want, that user can only select values in dropdown list. How can I do that, and does solution depend on datasource type? (I'd prefer solution with arraylist). tx a lot, matej
-
I know, that this questions are newbie like, but how can I then cycle through ArrayList? if it would be ordinary array, I woudl do For i = 0 to Ubound(myVariable) Messagebox.show(myVariable(i)) Next i How can I do this with arraylist? tx, matej
-
Hi. I want to create a report with subreports. Until now I have created 2 reports, which seperately work ok. How can I make them to work in one report (like subreport). Here is the code: 'fill dataset Me.OleDbConnection1.ConnectionString = sConnect 'main report Me.daDMOpis.SelectCommand.CommandText = "SELECT * from DMOpis where id = " & ajdi Me.daDMOpis.Fill(Me.DsView1) 'subreport temeljne naloge Me.daTemeljneNaloge.SelectCommand.CommandText() = "SELECT dbo.DMTabele.id_sifranta, dbo.DMTabele.id, dbo.DMTabele.tip, dbo.DMTabele.stopnja, dbo.DMTabele.standard3, dbo.DMTabele.standard2, dbo.DMTabele.standard1, dbo.DMTabele.id_DMOpis, dbo.DMSifrant.opis AS TemeljneNaloge, DMSifrant_1.opis AS Standard1, DMSifrant_2.opis AS Standard2, DMSifrant_3.opis AS Standard3 FROM dbo.DMTabele INNER JOIN dbo.DMSifrant ON dbo.DMTabele.id_sifranta = dbo.DMSifrant.id INNER JOIN dbo.DMSifrant DMSifrant_1 ON dbo.DMTabele.standard1 = DMSifrant_1.id INNER JOIN dbo.DMSifrant DMSifrant_2 ON dbo.DMTabele.standard2 = DMSifrant_2.id INNER JOIN dbo.DMSifrant DMSifrant_3 ON dbo.DMTabele.standard3 = DMSifrant_3.id WHERE (dbo.DMTabele.tip = 7) AND (dbo.DMTabele.id_DMOpis =" & ajdi & ")" Me.daTemeljneNaloge.Fill(Me.DsView1) 'fill report with dataset 'main report Dim Report = New CrystalReport1 Report.setdatasource(Me.DsView1) 'subreport temeljne naloge Dim repTN As New crTemeljneNaloge repTN.SetDataSource(Me.DsView1) 'Me.CrystalReportViewer1.ReportSource = repTN 'here I just checked if subreports works Me.CrystalReportViewer1.ReportSource = Report Me.CrystalReportViewer1.Zoom(2) 'so how can I make subreport (crTemeljneNaloge (repTN)) to be correctly displayed in main report (CrystalReport1 (report)) tx a lot matej
-
hm.... that is exacty what my question was. I don't know how to do it. Can you post sample code please?
-
hi. is there any faster way (like: MyReader = myVariable)? While MyReader.Read ReDim Preserve myVariable(i) myVariable(i) = MyReader("id") i = i + 1 End While
-
retrieve id from database (SQL) while updateing dataset
mcerk replied to mcerk's topic in Database / XML / Reporting
I see. And which row did I add? DataSet.Table1.Rows.Add(NewRow) Is it Dataset.Table1.Rows.count-1 ???? tx matej -
retrieve id from database (SQL) while updateing dataset
mcerk replied to mcerk's topic in Database / XML / Reporting
one solution is this: DataAdapter.Update(Dataset.Table1) myID = RetrieveID("SELECT top 1 * FROM opisDM ORDER BY id desc") ... Private Function RetrieveID(ByVal sSQL As String) Dim MyConnection As New OleDbConnection(sConnect) MyConnection.Open() Dim MyCommand As New OleDbCommand(sSQL, MyConnection) Dim MyReader As OleDbDataReader = MyCommand.ExecuteReader() While MyReader.Read RetrieveID = MyReader("id") End While MyConnection.Close() MyReader.Close() MyCommand.Dispose() End Function while I'm adding only one record at the time, this should work. but what it I yould be adding multiple records, or if the server would be so busy, that would actually retrieve wrong ID (many people are adding records at same time)) -
Hi. I want to update dataset into a table with 'autoincrease id field'. I'm updating it like this: Dim NewRow As DataRow = Me.DataSet.Table1.NewRow With NewRow .Item("Field1") = "value 1" .Item("Field2") = "value 2" .Item("Field3") = "value 3" me.text = .Item("id") 'at this stage, I got an ID generated by ??? (but it is suretanely not generated by SQL server) End With DataSet.Table1.Rows.Add(NewRow) 'update dataset DataAdapter.Update(DataSet) 'there dataset is actually updated to SQL server database. So. My question is. How can I figure out which 'id' is generated by SQL server. (I need it to manually update related tables). PS: I do not copy the whole database table into dataset, but only one, or few records. So it is impossible for dataset to figure out exact 'id' that would be generated by SQL server. tx a lot, matej
-
Hi. Does anyone of you have a working datagrid combobox column style class (in VB.NET)? And the sample? I would appreciate, if you can post a solution. (I believe that it would help a lot of people). If noone will do it, I'll try to learn myself, and try to post a solution. tx matej PS: There is one such thing in MSDN, but it's written in C#. Can I convert it to VB.NET? tx again
-
I have 2 tables in my Dataset. They are related with a constraint. I use Datagrid to move thru records and textboxes to edit values. Textbox Databindig text properties are set to my Dataset. When I set Databinding to the DataGrid everything works fine. Me.DataGrid1.SetDataBinding(Me.DataSet, "Table1") My textboxes show current record selected in datagrid. OK. that is fine. But I want to manually fill some other records. That is why I would like to find out "Table1.id" field of selected DataGrid record. How can I do this? BTW: this code doesn't work when DataGrid.SetDataBinding is set, but works, if DataGrid.SetDatabinding is not set!!!!!!!! 'I need this code, to figure out 'Table1.id' of selected record. dim variableID as Integer variableID = Me.DataSet.Table1.Rows(Me.BindingContext(Me.DataSet.Table1).Position).Item("id") So my question is, how can I change code for variableID, that it will worke while datagrid Databinding is set???? tx matej
-
Updating Dataset and updating dataset to database
mcerk replied to mcerk's topic in Database / XML / Reporting
I figured it out, and I am posting it for other newbies. DataAdapter.Fill(DataSet) 'now data is copied from database to dataset, and datagrid displays this data Textbox1.text = "Some Text" 'so, how can I do next : 'when I press Button1 textbox1.text is updated to Field1 in dataset (but not to database) Dim NewRow As DataRow NewRow = DataSet11.Tables("Table1").NewRow NewRow.Item("Field1")=Me.TextBox1.Text DataSet11.Tables("Table1").Rows.Add(NewRow) 'when I press Button2, the whole DataSet is updated back to database DataAdapter.Update(DataSet) -
Updating Dataset and updating dataset to database
mcerk posted a topic in Database / XML / Reporting
Hi. If I understand correctly, dataset is a copy of database. So my question is. How can I programatically update Field1 value to dataset, and how can I then update dataset back to database (for example SQL). For example: I have Textbox1, Button1, Button2 and DataGrid1 on Form1. Textbox1 is not bound to dataset, but Datagrid is. I know how to make a connection to database and how to fill dataset. DataAdapter.Fill(DataSet) 'now data is copied from database to dataset, and datagrid displays this data Textbox1.text = "Some Text" 'so, how can I do next: 'when I press Button1 textbox1.text is updated to Field1 in dataset (but not to database) and I want that DataGrid would display new value. 'when I press Button2, the whole DataSet is updated back to database tx a lot -
Hi I don't know what is wrong here. I allways got this error message: Here is my code: OleDbConnection2.ConnectionString = sConnect OleDbDataAdapter1.Fill(Me.DsOpisDM1, "opisDM") Me.daZahtevanaZnanja.Fill(Me.DsOpisDM1, "x_dodatnaZnanja") DsOpisDM1.Relations.Add("relation", DsOpisDM1.Tables("opisDM").Columns("id"), DsOpisDM1.Tables("x_dodatnaZnanja").Columns("id_opisDM")) if I disable last row (DSOpisDM1.Relations.Add ...) then the program runs perfectly OK. Datasets are filled . . . What am I doing wrong. With this relation I want that only specific rows in x_dodatnaZnanja are displayed.... tx matej
-
OK. I have changed my SQL SELECT clause, so there is no duplicates in field names. (ColumnMapping names are just field names). But nothing changes. My Datagrid still displays all fields selected in SQL SELECT clause. Do I need to tell datagrid to actually use this created TableStyle, and how. tx, matej
-
yes, but if I do OleDbConnection.Fill(dataset) then dataset got filled again (previous data is not cleared). so I need to clear it first. how can I do this?
-
Hi. I use dataset only to display data. I do updateing with executing INSERT SQL statement with myCommand.ExecuteNonQuery() ok. But after I insert data, I need to refresh dataset, to display correct content. How can I do this, and - is it ok if I do so, or do I have to change methods? tx matej
-
hm... it somehow doesnt work. I put this code to form_load (after I filled dataset). 'define Datagrid!!! Dim ts As New DataGridTableStyle Dim col1 As New DataGridTextBoxColumn col1.MappingName = "temeljnenaloge.opis" col1.HeaderText = "Temeljna naloga" ts.GridColumnStyles.Add(col1) Dim col2 As New DataGridTextBoxColumn col2.MappingName = "sif_standardi.id" col2.HeaderText = "Standard 1" ts.GridColumnStyles.Add(col2) Dim col3 As New DataGridTextBoxColumn col3.MappingName = "sif_standardi_1.id" col3.HeaderText = "Standard 2" ts.GridColumnStyles.Add(col3) Dim col4 As New DataGridTextBoxColumn col4.MappingName = "sif_standardi_2.id" col4.HeaderText = "Standard 2" ts.GridColumnStyles.Add(col4) '(repeat blocks as necessary) DataGrid1.TableStyles.Clear() DataGrid1.TableStyles.Add(ts) Just nothing happens. App runs normally, no error, there are still all columns displayed.... please help
-
Hi. I want to catch if delete key was pressed in listbox control. Private Sub ListBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ListBox1.KeyPress Me.Text = e.KeyChar Select Case e.KeyChar End Select in this code just characters are recognised. If I press 'Del' nothing happens. any help. tx matej