
man_luck
Members-
Posts
16 -
Joined
-
Last visited
man_luck's Achievements
Newbie (1/14)
0
Reputation
-
Hi, I want to connect to an Access database on the server and not on my local machine.I dont know how to achieve this.I am able to connect to the database on local machine ,both in access ans SQl server.Moreover when I use VB.Net,I am able to establish connection to SQL Server on the server and results displayed in a DataGrid but same thing is not achieved when I try to use ASP.Net.......................it gives the error :- "Login failed for user 'THINK\MANISH$'." where THINK is my local domain and Manish is the name of my computer on this domain. Does the code differ in VB.Net and ASP.net when we use SQL Server on another machine?And how do I establish connection to an Access database on some other machine?
-
I am developing an application in which I need to list all the URL's in the browsers which are currently open.Also I need to count the number of web browsers which are currently open.How do I do that.Do I have to use System.Net namespace or System.Web namespace?
-
I want to retrieve data from an excel sheet and display it in datagrid. I have the following code(not showing the declarations) : con = New OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=c:\CAD.xls;Extended Properties=""Excel 8.0""") cmd = New OleDb.OleDbCommand("Select * from [delete2$]", con) dataset.Clear() Try adap.SelectCommand = cmd adap.Fill(dataset, "[delete2$]") dg.DataSource = dataset.Tables(0).DefaultView Catch exp As Exception MsgBox(exp.Message) End Try the program is neither giving any error nor displaying the contents of the excel sheet.Please guide me how to display the contents of the excel sheet(File name is CAD.xls and the sheet name is delete2).
-
I got my problem fixed. this is a feature(or a bug) of ASP.Net http://www.codeproject.com/useritems/SyncControl.asp
-
here is the full scripting code <%@ Import namespace="System.Data.OleDb" %> <%@ Import namespace="System.Data" %> <%@ Page Language="vb"%> <HTML> <script runat="server"> dim conn as new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:/banking.mdb") sub Page_Load(Sender as object, e as EventArgs) if not Page.IsPostBack then FillDataGrid() end if end sub sub Submit(Sender as object, e as EventArgs) dim i,j as Integer dim params(7) as String dim strText as string dim blnGo as boolean=true j=0 for i=0 to AddPanel.Controls.Count -1 if AddPanel.controls(i).GetType is GetType(TextBox) then strText=CType(AddPanel.Controls(i),TextBox).Text if strText <> "" then params(j)=strText else blnGo=false lblMessage.Text=lblMessage.Text & "You forgot to enter a value for " & AddPanel.Controls(i).ID & "<p>" lblMessage.Style("ForeColor")="Red" end if j=j+1 end if next if not blnGo then exit sub end if dim strSQL as string="INSERT INTO tblUsers(FirstName,LastName,Address,City,State,Zip,Phone) values('" & params(0) & "','" & params(1) & "','" & params(2) & "','" & params(3) & "','" & params(4) & "','" & params(5) & "','" & params(6) & "')" ExecuteStatement(strSQL) FillDataGrid() end sub sub dgData_Edit(Sender as object, e as DataGridCommandEventArgs) FillDataGrid(e.Item.ItemIndex) end sub sub dgData_Delete(Sender as object, e as DataGridCommandEventArgs) ---------- ---------- end sub sub dgData_Update(Sender as object, e as DataGridCommandEventArgs) ---------- -------- end sub sub dgData_Cancel(Sender as object, e as DataGridCommandEventArgs) ------------ ------------ end sub sub dgData_PageIndexChanged(Sender as object, e as DataGridPageChangedEventArgs) dgData.DataBind() end sub function UpdateDataStore( e as DataGridCommandEventArgs) as boolean dim i,j as integer dim params(7) as string dim strText as string dim blnGo as boolean= true j=0 for i=1 to e.Item.Cells.Count - 3 strText=CType(e.Item.Cells(i).Controls(0),TextBox).Text if strText <> "" then params(j)=strText j=j+1 else blnGo=false lblMessage.Text=lblMessage.Text & "You forgot to enter a value<p>" end if next if not blnGo then return false exit function end if dim strSQL as string="Update tblUsers set FirstName='" & params(0) & "',LastName='"& params(1) & "',Address='"& params(2) & "',City='"& params(3) & "',State='"& params(4) & "',Zip='"& params(5) & "',Phone='"& params(6) & "'where ID = " & CType(e.Item.Cells(0).Controls(1),Label).Text ExecuteStatement(strSQL) return blnGo end function sub FillDataGrid(Optional EditIndex as integer=-1) dim objCmd as new OleDbCommand("select * from tblUsers",Conn) dim objReader as OleDbDataReader try objCmd.Connection.Open() objReader=objCmd.ExecuteReader() catch ex as Exception lblMessage.Text = "Error retrieving from the database" end try dgData.DataSource=objReader if not EditIndex.Equals(Nothing) then dgData.EditItemIndex = EditIndex end if dgData.DataBind() objCmd.Connection.Close() end sub function ExecuteStatement(strSQL) dim objCmd as new OleDbCommand(strSQL,Conn) try objCmd.Connection.Open() objCmd.ExecuteNonQuery() catch ex as Exception lblMessage.Text="Error Updating the database" end try objCmd.Connection.Close() end function </script> and then the html coding is there.I guess this code is enough.
-
I have a datagrid and a few text boxes with a submit button.the user enters the data and presses the submit button.The submit function is called and the data is entered in the database and the change is reflected in the datagrid.Now on refreshing the page,it again calls the submit button and enters the data into the databbase and thereby reflecting the changes in the datagrid. here's the partial code: sub Page_Load(Sender as object, e as EventArgs) if not Page.IsPostBack then FillDataGrid() end if end sub sub Submit(Sender as object, e as EventArgs) dim i,j as Integer dim params(7) as String dim strText as string dim blnGo as boolean=true ---------- ------ --------- --------- --------- -------- --------- end sub i want the data not to get entered in the database again on refreshing the page(obviously).How shud i do this?
-
can any1 tell me how to retrieve time from the local machine and which namespace we are supposed to use.
-
thanx i have got it right and now its working fine :)
-
Hey i have figured out how to make combo box read only without making a user control. My code is as follows: Private Sub cboDepartmentName_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboDepartmentName.TextChanged cboDepartmentName.Text = "" End Sub though i have achieved what i wished to do but still i would like to know how to create user control readonly combobox.
-
I want to create my own user control.I know i have to start "Windows Control Library" project and then i can define property, events and/or methods.But the problem is i want to create readonly combobox.I drag and drop a cobo box on the form.Now how to define this property? The code should go like this Property ReadOnlyCbo() As Boolean Get End Get Set(ByVal Value As Boolean) End Set End Property Can anyone tell me what code should go inside. :o
-
Get database connection string from a xml file
man_luck replied to dhj's topic in Database / XML / Reporting
you can use MSXML 4 class from http://www.microsoft.com/downloads/details.aspx?FamilyID=3144b72b-b4f2-46da-b4b6-c5d7485f2b42&displaylang=en declare object as, Dim objDoc2 As New MSXML2.DOMDocument30() i had used following code: If objDoc2.load(Directory.GetCurrentDirectory & "\config.xml") Then If Not objDoc2 Is Nothing Then pathtosavexmlfiles = objDoc2.getElementsByTagName("storepath_mails_invoices").item(0).text path_of_the_database = objDoc2.getElementsByTagName("dataSource").item(0).text If Not (pathtosavexmlfiles.Substring(pathtosavexmlfiles.Length - 1) = "\") Then pathtosavexmlfiles = pathtosavexmlfiles & "\" 'If a back slash is missing from the path, it will be inserted here End If 'Dim path_of_the_database As String End If End If here the xml file is config.xml and "storpath_mails_invoices" is the tag name which reads the path to which files are to be saved(this is happening in my case........u can give the path to do anything else).The config.xml file exists in the current directory. i think this will be sufficient.if you have any other doubts feel free to ask -
i want to know what is Windows CE which is used to develop smart device applications and what exactly we mean by smart devices. I wan to try my hand on developing mobile applications using VB.Net but i cant figure it out how to go about it. i am using VS.net 2003 which has options for developing mobile applications.I dont know which type of project to use........whether ASP.Net Mobile Web Aapplication or Smart Devices Application. kindly tell me how to go about it from scratch
-
thanx 4 the reply.but a few of my doubts still remain unclear.I mean when we connect to access database we give a connection string as connectionCalenderEvent = New OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=c:\CRMdatabase.mdb") do we need to mention a provider to connect to mysql database? and if so which proider shall i list? as i said i was able to connect to mysql database without mentioning the provider
-
hi , this is my first post on the group.I have just started working on vb.net and was able to connect to msaccess,with the following as connectionstring: connectionCalenderEvent = New OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;data source=c:\CRMdatabase.mdb") now i want to connect to MYSQL .i know for that i have to use oledbconnection class.now i have a few doubts, 1)what exactly we mean by ODBC driver and OLEDB driver? 2)which provider shall i use for connecting to MYSQL 3)What do we mean by a driver and a provider? moreover i was able to connect to mysql server(which is on the local machine) as follows: conPat_Details = New MySqlConnection("Host=localhost;Database=Appointments;User Id=manish;Password=manish99;Compress=True") I have imported Corelab.Mysql class Kindly make my doubts clear(assume i have a very elementary knowledge) thanx