|
|
He's posted the same thing in at least 4 forums.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Don't cross post. It is very rude.
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
For a tableAdapter , vb.net usually create automatically the fill() function .But i want to create a fill(parameter1) function where parameter1 is a value that filter data (by a filed ) filled into dataset.How can i do this ?
Thank you !
|
|
|
|
|
You'd have to write your own method to do this. Although, you would normally call the method something like "GetSomethingBySomeValue", not Fill(value). Make the name of the method meaningful. The concept is called "self documenting code". The name of the method should tell you what it does.
You can use the designer to help you do this by right-clicking the table you want in the dataset designer, and clicking Add Query...
|
|
|
|
|
Hi
I am quite new to this and have made a web project written in vb. Now i want to make a installer for this program and have created a web setup project and a custom action for that project. The thing is that during the install ui i want to run som code when the "next button" is pushed during one of the dialogs. How do i do this?
Confused
|
|
|
|
|
The custom action needs to run an exe with your code in it, you can't inject code into an MSI.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Cant you run for example Orca to customize a button and make it call a external dll or in some other way make it run som code that way? What i need is when a user enters the database name that he wants to use with the web project the program should check if the db already exists before he continues so that he can change the name.
Confused
|
|
|
|
|
Dim DBPath As String
Dim ADOXcat As New ADOX.Catalog
Dim sCreateString As String
DBPath = System.Windows.Forms.Application.StartupPath()
sCreateString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath & "\New07ADB.accdb;Jet OLEDB:Database Password=admin;" 'for Access 2007
Try 'Create DB
ADOXcat.Create(sCreateString)
Catch ex As System.Runtime.InteropServices.COMException
'create DB failed
MsgBox(ex.Message(), MsgBoxStyle.Critical, "Failed to create database")
Finally
ADOXcat = Nothing
End Try
Dim ADOXtable As New ADOX.Table(), _
ADOXindex As New ADOX.Index(), _
Con As New ADODB.Connection()
Try 'connect and insert tables
Con.Open("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & DBPath & "\New07ADB.accdb;Jet OLEDB:Database Password=admin;") 'for 2007
MsgBox(Con.Errors().Count.ToString()) 'Displays 0 Errors
MsgBox(Con.State.ToString()) 'Displays 1 representing an open connection
'Open the Catalog
ADOXcat.ActiveConnection = Con 'Object reference not set to an instance of an object.
I know this error usally gets generated when using a null object but if I receive no errors from opening the connection then 'Con' shouldnt be null right? Any help on this is greatly appreshated.
|
|
|
|
|
Your con is fine, it is the ADOXCat that is not instantiated!
Quote from Great Outdoors:
its a confident traveller who farts in India
|
|
|
|
|
--> which symmetric algorithm is efficient to encrypt video file and why?
--> how can i compress video file in dotNet environment?
J A Nasir K
|
|
|
|
|
1 - they all are, to one degree or another. XVid and DivX are good, but so is MPG.
2 - by using DirectX
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i try to add datepicker to datagrid but i can see it, way?
Private Sub dg2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles dg2.MouseDown
dtp.Dock = DockStyle.Fill
dtp.Cursor = Cursors.Arrow
dtp.SendToBack()
hitTestGrid = dg2.HitTest(e.X, e.Y)
If hitTestGrid.Column = 5 Then
datagridtextBox.TextBox.Controls.Add(dtp)
dtp.BringToFront()
End If
datagridtextBox.TextBox.BackColor = Color.Black
End Sub
|
|
|
|
|
liat1234 wrote: datagridtextBox.TextBox.Controls.Add(dtp)
You can't add a datetimepicker to a textbox. You can't add any controls to a textbox, unless you are using WPF
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
i try to update my data base but i get this error message
"the update command effected 0 of the expected 1 records"
the insertcommand is ok
my code is
Private Sub btnUPDT_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUPDT.Click
'--------------------------------
'INSERT NEW ROWS
'--------------------------------
cmd.InsertCommand = New OleDbCommand()
Dim pCust_name1 As New OleDbParameter("@name1", OleDbType.VarChar)
pCust_name1.SourceColumn = "name"
Dim pCust_pass1 As New OleDbParameter("@pass1", OleDbType.VarChar)
pCust_pass1.SourceColumn = "pass"
Dim pCust_meried1 As New OleDbParameter("@meried1", OleDbType.Boolean)
pCust_meried1.SourceColumn = "meried"
Dim pCust_city1 As New OleDbParameter("@city1", OleDbType.VarChar)
pCust_city1.SourceColumn = "city"
Dim pCust_borndate1 As New OleDbParameter("@borndate1", OleDbType.Date)
pCust_borndate1.SourceColumn = "borndate"
cmd.InsertCommand.Parameters.Add(pCust_name1)
cmd.InsertCommand.Parameters.Add(pCust_pass1)
cmd.InsertCommand.Parameters.Add(pCust_meried1)
cmd.InsertCommand.Parameters.Add(pCust_city1)
cmd.InsertCommand.Parameters.Add(pCust_borndate1)
cmd.InsertCommand.Connection = Conn
cmd.InsertCommand.CommandText = "INSERT INTO users " & _
"(name, pass, meried, city, borndate)" & _
"VALUES (@name1, @pass1, @meried, @city, @borndate)"
'------------------------------------------
'UPDATE ROW
'------------------------------------
cmd.UpdateCommand = New OleDbCommand()
Dim pCust_id As New OleDbParameter("@id", OleDbType.Integer)
pCust_id.SourceColumn = "id"
Dim pCust_name As New OleDbParameter("@name", OleDbType.VarChar)
pCust_name.SourceColumn = "name"
Dim pCust_pass As New OleDbParameter("@pass", OleDbType.VarChar)
pCust_pass.SourceColumn = "pass"
Dim pCust_meried As New OleDbParameter("@meried", OleDbType.Boolean)
pCust_meried.SourceColumn = "meried"
Dim pCust_city As New OleDbParameter("@city", OleDbType.VarChar)
pCust_city.SourceColumn = "city"
Dim pCust_borndate As New OleDbParameter("@borndate", OleDbType.VarChar)
pCust_borndate.SourceColumn = "borndate"
cmd.UpdateCommand.Parameters.Add(pCust_id)
cmd.UpdateCommand.Parameters.Add(pCust_name)
cmd.UpdateCommand.Parameters.Add(pCust_pass)
cmd.UpdateCommand.Parameters.Add(pCust_meried)
cmd.UpdateCommand.Parameters.Add(pCust_city)
cmd.UpdateCommand.Parameters.Add(pCust_borndate)
cmd.UpdateCommand.Connection = Conn
cmd.UpdateCommand.CommandText = " UPDATE users SET [name]= @name, [pass]= @pass, [meried]=@meried WHERE [id] =@id"
cmd.Update(ds1, "users")
MsgBox("update table ended")
End Sub
|
|
|
|
|
hi
your code is fine, you have made it complicate you. in this cases, please use a Procedure to insert a new record into the table to avoid Sql injection. and i dont know how you gonna update a datagrid like that. check this article on how to update a datagrid.
.
http://www.codeproject.com/useritems/N-Tier_Application_VB.asp[^]
Hope i helps
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
i wrote this code but always row index 0 is deleted
where i wrong????
Private Sub btnDel_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDel.Click
Dim i As Integer
Dim usrId As String
ds1.GetChanges()
i = dg2.CurrentRowIndex()
usrId = dg2.Item(i, 0)
'delete from dataset
ds1.Tables(0).Rows(i).Delete()
cmd.DeleteCommand = New OleDbCommand()
cmd.DeleteCommand.Connection = Conn
cmd.DeleteCommand.CommandText = "delete * from users where id =" & usrId
'delete from database
cmd.Update(ds1, "users")
End Sub
liat
|
|
|
|
|
liat1234 wrote: i = dg2.CurrentRowIndex()
The current row index must be 0. If you want to delete a different row, select the row you want to delete by setting this property.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
You may try to do this in the following manner.
Dim con As SqlConnection
Dim adap As SqlDataAdapter
Dim ds As New DataSet
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
binddata()
End Sub
Dim i As Integer
Dim s As String
Private Sub DataGrid1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.Click
i = DataGrid1.CurrentRowIndex
s = DataGrid1.Item(i, 0)
End Sub
Sub binddata()
Try
con = New SqlConnection("server=200.100.100.139;user id=sa;pwd=hello;database=pubs;")
con.Open()
adap = New SqlDataAdapter("select * from employee", con)
adap.Fill(ds)
DataGrid1.DataSource = ds.Tables(0)
Catch ex As Exception
MsgBox(ex.Message)
Finally
con.Close()
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
con = New SqlConnection("server=200.100.100.139;user id=sa;pwd=hello;database=pubs;")
con.Open()
Dim cmd As New SqlCommand
cmd = New SqlCommand("delete from employee where emp_id='" & s & "'", con)
cmd.ExecuteNonQuery()
binddata()
Catch ex As Exception
MsgBox(ex.Message)
Finally
con.Close()
End Try
End Sub
I hope this helps.
Regards,
John Adams
ComponentOne LLC
|
|
|
|
|
Hello every one...
I am developing a application in vb.net, i want the text in mask box to be selected when a user enters in it..
I was able to do the same with Vb6, i am not able to do in VB.net 2005 Express..
Is the same also possible with text box??
Regards
Nishkarsh
|
|
|
|
|
Yes, you can set the selection index and selection length of the textbox when the focus/enter event occurs
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi all
Plz give me a sample about read a barcode from scanner and save it to database.
Thanks
|
|
|
|
|
Do you have a barcode scanner ? If not, how will you use the code ? If so, have you read the manual that came with it, explaining how to interact with it in code ?
We don't do people's work here, we help people who have tried and are stuck. It sounds to me like you want to do two well defined things, both of them easily answered with resources you should have ( a scanner with a manual and google )
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Barcode scanners typically emulate keyboard input... and are not a seperate device! They plug right into the Keyboard jack in parallel!
I designed and built a complete Point-of-Sale system in VBA for Access.
|
|
|
|
|
Hi,
In VB.Net how can I declare an varible in one line and instantiate it in another?
such this that can do in C#:
DataTable dt;
dt = new DataTable();
Best wishes
|
|
|
|