|
|
Take a look at this link:
http://www.codeproject.com/cs/miscctrl/datagridcomboboxcolumn.asp
|
|
|
|
|
hellow to all ..
i am trying to write sql statment , it run fine ..
but when i run the statment i have this error "Syntax error in FROM clause"
her is my code
Dim sConnection, ssql, cmtype As String
sConnection = "provider=microsoft.jet.oledb.4.0;data source=C:\Printers.mdb"
ssql = "Select * From add Where(type="
ssql = ssql & "'" & Cmbtype.SelectedItem & "')"
Try
Dim OleDbConn As OleDbConnection = New OleDbConnection(sConnection)
OleDbConn.Open()
Dim MyDataReader As OleDbDataReader
Dim MyOleDbCommand As OleDbCommand = New OleDbCommand
Dim MyDataSet As New DataSet
Dim MyOleDataAdapter As OleDbDataAdapter = New OleDbDataAdapter
MessageBox.Show(ssql)
MyOleDataAdapter.SelectCommand = New OleDbCommand(ssql, OleDbConn)
MyOleDataAdapter.Fill(MyDataSet)
MyOleDbCommand.Connection = (OleDbConn)
MyOleDbCommand.CommandText = ssql
MyDataReader = MyOleDbCommand.ExecuteReader
Do While MyDataReader.Read
cmbModel.Items.Add(MyDataReader("ADD.[דגם מכונה]"))
Loop
MyDataReader.Close()
OleDbConn.Close()
OleDbConn.Dispose()
Catch err As System.Exception
MessageBox.Show(err.Message)
End Try
thxx for anyhelp ...
|
|
|
|
|
microuser_2000 wrote:
Select * From add Where(type=
add is a keyword. You can't use it as a table name. If this is an Access database, you might get away with putting square braces around the name, like this:
Select * From [ADD] WHER (type=...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Once you populate a datagrid with information from a database. What is the best way to access the data stored in the datagrid. e.g. If I want to know what is in column 3 row 6, and display it in a simple label.
Whats the best way to go about that?
|
|
|
|
|
Hello!
You can access the data of a cell by simple statement...
DataGridName.Item(RowIndex, ColIndex) <---
_mubashir
|
|
|
|
|
When I try that I recieve the error that.
'item' is not a member of 'System.Web.UI.WebControls.DataGrid'
|
|
|
|
|
I can not be 100% sure since i do not have .NET installed on this machine, but I thinks you can access an item by using:
DataGrid1.Items(0).Cells(1).Text()
The example that mubashir wrote applies to VB.NET Application and I see your application is an asp.net app
|
|
|
|
|
Yaaaaaass!!!! It worked, I can't believe I've spent so long on such a little problem.
Cheers!
|
|
|
|
|
I'm having problems trying to hash a password in Visual Basic NET. The result of my code is different that the result of my php page.
My VBNET code is this
Dim md5 As MD5CryptoServiceProvider<br />
Dim bytValue() As Byte<br />
Dim bytHash() As Byte<br />
md5 = New MD5CryptoServiceProvider<br />
bytValue = System.Text.Encoding.UTF8.GetBytes(txtPassword.Text)<br />
bytHash = md5.ComputeHash(bytValue)<br />
md5.Clear()<br />
messagebox.show(Convert.ToBase64String(bytHash))
The result is "bXOF/9d64JOf/waR9/mEFQ=="
In PHP with his simple code
echo md5($password);
shows "6d7385ffd77ae0939fff0691f7f98415"
Maybe anyone can say me why is different? Wich is the good VB code to show the same that in PHP?
Thanks in advance
|
|
|
|
|
Md5 results in a 128-bit number, php's function displays this in hexadecimal this is not the same as using ToBase64String.
I don't know if there is a better way but this seemed to work
<br />
Dim md5 As MD5CryptoServiceProvider<br />
Dim bytValue() As Byte<br />
Dim bytHash() As Byte<br />
Dim sb As StringBuilder = New StringBuilder(32)<br />
Dim i As Integer<br />
md5 = New MD5CryptoServiceProvider<br />
bytValue = System.Text.Encoding.UTF8.GetBytes(txtPassword.Text)<br />
bytHash = md5.ComputeHash(bytValue)<br />
md5.Clear()<br />
For i = 0 To bytHash.Length - 1<br />
sb.Append(bytHash(i).ToString("x"))<br />
Next<br />
MessageBox.Show(sb.ToString())<br />
|
|
|
|
|
Thanks a lot!!
The code not works completely, but it's very close.
Every time you append the text, sb is 2 characters longer. The problem appears when the bythash(i).toString("x") returns 1 character.
VBNET "6d 73 85 ff d7 7a e0 93 9f ff 6 91 f7 f9 84 15"
PHP "6d 73 85 ff d7 7a e0 93 9f ff 06 91 f7 f9 84 15"
How is the clever way to always return 2 characters? How can I format this?
NOTE: My txtpassword.text is "pasa"
|
|
|
|
|
A workaround is this
<br />
For i = 0 To bytHash.Length - 1<br />
str = bytHash(i).ToString("x")<br />
If str.Length = 1 Then<br />
str = "0" & bytHash(i).ToString("x")<br />
End If<br />
sb.Append(str)<br />
Next<br />
But there is a clever way for sure.
Anybody?
|
|
|
|
|
Try using ToString("x2") that should do the same as your workaround.
|
|
|
|
|
Hi,
I need to populate a list with columns of ms access table
can we do a select statment to have name of columns for a specific tables in an access database
Thanks in advance
TG
|
|
|
|
|
just finished creating my web application which saves any input info to an sql server. was just wondering if anyone knew of any software that would convert the database entries to pdf.
|
|
|
|
|
Hi
I have a Textbox and User has to input some numbers in it. Also i have some code in the textbox textchanged event.
Problem is when i start entering the data, it immediately raises the text changed event without allowing me to complete the data input.
That is, if i want to enter 0.18, it raises the Textchanged event after 0 is entered.But i want to raise the event only after finishing the data input(0.18). Is there anyway of achieving this ?
Thanks
|
|
|
|
|
you could search for the "loose focus" event...
otherwise, the textchanged event can work, but you'll have to explain what you really need to do...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi
Sorry i cudn't get what you said.
All i need to do is when i try to enter some data in the textbox, the textchanged event should not be raised until the data input is completely done.
In the Textchanged event i have a function which calculates a value, say X = A + B, where A is taken from the textbox.
Now as the value is a double i need to enter something like 0.18, but the textchanged event is fired even before i complete the data input so A is 0 instead of 0.18.
I am not sure how the lostfocus() event would help in this situation.
Thanks
|
|
|
|
|
prathiba_naresh wrote:
I am not sure how the lostfocus() event would help in this situation.
you are certain the user ended typing into the text box...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Yes, but the problem is thats the last textbox and user won't click on anyother button to raise the lost focus event.
As soon as the user finishes entering the number i need to display the result in another textbox..(In this case the textbox still has focus)
|
|
|
|
|
use Validating Event of textbox
|
|
|
|
|
Solves the problem partially.
Problem is this is the last textbox and user will not remove the focus from this textbox, even the Validating event will fire only if the user clicks anywhere else.
Anyway thanks for your inputs.
|
|
|
|
|
Using the text_changed event is in my opinion no good idea for getting data from user.
As you mentioned, you want the user to ENTER data, so on the last textbox (or even on your form) on the Key_Press event, check for enter key.
So you fill the textboxes and just simply press Enter and everything goes fine.
Hope it helps
|
|
|
|
|
Hi
Thanks for ur help. Will try this.
|
|
|
|