Search the Community

Showing results for tags 'vb.net'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 18 results

  1. Could somebody tell me how to update table with datagridview with blank cell in it? I have created a data entry form with datagridview with two columns in designer. I want to leave some cells of a column blank and save blank cells as zero in table. If there are no blank cells I can save datagridview content into table Dim thisConnection As New SqlConnection() Dim nonqueryCommand As SqlCommand = thisConnection.CreateCommand() Try ' Open Connection thisConnection.Open() Console.WriteLine("Connection Opened") ' Create INSERT statement with named parameters nonqueryCommand.CommandText = _ "INSERT INTO myTable (Col1, Col2) VALUES (@Col1, @Col2)" ' Add Parameters to Command Parameters collection nonqueryCommand.Parameters.Add("@Col1", SqlDbType.VarChar, 50) nonqueryCommand.Parameters.Add("@Col2", SqlDbType.VarChar, 50) ' Prepare command for repeated execution nonqueryCommand.Prepare() ' Data to be inserted For Each row As DataGridViewRow In DataGridView1.Rows If Not row.IsNewRow Then nonqueryCommand.Parameters("@Col1").Value = row.Cells(0).Value.ToString nonqueryCommand.Parameters("@Col2").Value = row.Cells(1).Value.ToString End If Next nonqueryCommand.ExecuteNonQuery() Catch ex As SqlException ' Display error Console.WriteLine("Error: " & ex.ToString()) Finally ' Close Connection thisConnection.Close() Console.WriteLine("Connection Closed") End Try I don’t know if this is correct way to check for empty cell in order to save into table. I get an error when I place the code between try and Catch ex As SqlException An OleDbParameter with ParameterName '@Col1' is not contained by this OleDbParameterCollection If row.Cells(0).Value.ToString IsNot Nothing Then nonqueryCommand.Parameters("@Col1").Value = row.Cells(0).Value.ToString() else nonqueryCommand.Parameters("@Col1").Value = "0" end if Dim thisConnection As New OleDbConnection("") Dim nonqueryCommand As OleDbCommand = thisConnection.CreateCommand() Try ' Open Connection thisConnection.Open() Console.WriteLine("Connection Opened") nonqueryCommand.CommandText = _ "INSERT INTO Table1 (Col1, Col2) VALUES (@Col1, @Col2)" ' Data to be inserted For Each row As DataGridViewRow In DataGridView1.Rows If row.Cells(0).Value.ToString IsNot Nothing Then nonqueryCommand.Parameters("@Col1").Value = row.Cells(0).Value.ToString() Else nonqueryCommand.Parameters("@Col1").Value = "0" End If If row.Cells(1).Value.ToString IsNot Nothing Then nonqueryCommand.Parameters("@Col1").Value = row.Cells(1).Value.ToString() Else nonqueryCommand.Parameters("@Col1").Value = "0" End If Next nonqueryCommand.ExecuteNonQuery() Catch ex As OleDbException ' Display error Console.WriteLine("Error: " & ex.ToString()) Finally ' Close Connection thisConnection.Close() Console.WriteLine("Connection Closed") End Try
  2. Hi Guys, i am facing a problem in updating precomplied website. i have a precompiled website on server. i have taken copy of that website on my local machine and done some changes in sql query which fetches some data. this query is under App_code folder. and then i have copied everything and overwrites existing folders of this website on server (including App_code folder) . but when i run website, it gives me error on App_code folder (error:this is precomplied website) . and that's why i have removed App_code folder from server. and then website works fine but whatever i have changed in new query doesn't get reflected. now i want to do those changes but i am not able to. please guide me. Regards, Rhishikesh
  3. I am trying to filter a table between two dates in ms access from vb.net . the query below does Not work when data type is date/ time . When I change data type to text, it gives me sum of the columns. Is there anyway to fix it? Thanks select * into Table3 from (SELECT 'Table6' AS [Table], SUM(a) - SUM( AS Result FROM table6 where date_ BETWEEN " & FromDate & " AND " & ToDate & " UNION ALL SELECT 'Table7', SUM(a) - SUM( FROM table7 where date_ BETWEEN " & FromDate & " AND " & ToDate & ")a"
  4. I am trying to assign data to dropdownlist in asp.net from textbox Textchanged event but dropdownlist not showing any data . actually i am trying to connect with database asynchronously so that i must able to see suggestions just like google instant related with whatever i am enetering in textbox but i can't get it. any help will be appreciated. vb.net code ---------------- Protected Sub tXtCustomer_TextChanged(ByVal sender As Object, ByVal e As EventArgs) Handles tXtCustomer.TextChanged Dim strsql4 As New StringBuilder Dim localdt4 As New DataTable With strsql4 .Append("select mc.ccncd,mp.partycd from mccn mc inner join mparty mp on mc.PartyCd=mp.partycd where mp.PartyCd like '" & tXtCustomer.Text & "%' ") End With localdt4 = CommonDb.ReturnDataTable(strsql4.ToString, "ERP") If localdt4.Rows.Count > 0 Then drpCcnTrial.DataSource = localdt4 drpCcnTrial.DataBind() drpCcnTrial.DataTextField = "ccncd" drpCcnTrial.DataValueField = "ccncd" drpCcnTrial.Items.Insert(0, New ListItem("Select CCN from List", 0)) End If End Sub asp.net code ----------------- <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Always" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="txtCustomer" EventName="TextChanged" /> </Triggers> <ContentTemplate> <asp:TextBox ID="tXtCustomer" runat="server" autopostback="true" ></asp:TextBox> <asp:DropDownList ID="drpCustomer" runat="server"> </asp:DropDownList> </ContentTemplate> </asp:UpdatePanel>
  5. case1 -------- Protected Sub lnkResdept_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim resdept As String resdept = sender.text End Sub case2 -------- Protected Sub lnkResdept_Click(ByVal sender As Object, ByVal e As System.EventArgs) resdept= CType(sender, LinkButton).Text end sub I am not able to understand difference between these two cases, case1 produces the linkbutton's value for example C1500017 and case2 also produces same result. I am not able to understand why explicit type casting is done in case2. thanks, Rhishikesh
  6. I am working with vb.net and want to upload file. i am using stringbuilder for building sql query. but not able to properly concatenate following sql statement in vb.net. path = ConfigurationManager.AppSettings.Get("resDeptCommentPath") .Append("actionDescFileName='" & fuActDescFile.FileName & "',actionfilepath='" & path & " " & '" & ViewState("DepartmentName") &"' & "ActionDescription" "',") & represented with green color is the error spot and it gives expresssion expected error. I guess, i am not concatenating things properly. help will be appreciated. note:don't consider .append for second line i have written this code in single line while coding.
  7. Dear All, I am working on project in asp.net and vb.net as code behind. The project needs to take a data from database and based on that data, I want to build orgchart(organization chart). so I decided to use third party control called as basic primitives. they have shown Jquery version of orgchart on their website. also they have provided primitive.js file which holds all the jquery classes which are required to build orgchart. but my problem is how to pass my data from database to these jquery classes for building orgchart note: I am using visual studio 2010 .
  8. please suggest me how i can access Gridview's column value under rowdatabound event. I have tried below Protected Sub GridView2_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView2.RowDataBound Dim asbcdval As String asbcdval = e.Row.Cells(0).Text end sub but this returns "" means nothing. please solve my problem
  9. I have read somewhere that, when i enable double buffer property of windows form it will reduce the flickering of images or graphics. but i not able to understand how exactly double buffer works please help me to understand it.
  10. I want open and close windows form by using same key. please suggest me how can i do it ? for example i want to open a window after first keypress of F1 , and want to close window after second keypress of F1
  11. <div onmousedown="mousedown(event)" onmousemove="mousemove(event)" onmouseup="mouseup(event)" id="dvpopupctl" runat="server" style="position:absolute;left:22%; top:34% ; width:500px ; height:auto; z-index:10001 ;display:none ;" > this is the div which i have displayed as popup. and now i want to make it draggable popup. i have tried through javascript but div moves only towards right side and towards bottom. i am not able to move popup to either left or upper side. following javascript functions i have used <script type="text/javascript"> // experiment for dragging div var flag1; function mousedown(e) { flag1 = 1; } function mousemove(e) { var cordx = 0; var cordy = 0; if (flag1 == 1) { if (!e) { var e = window.event; } if (e.pageX || e.pageY) { cordx = e.pageX; cordy = e.pageY; } else if (e.clientX || e.clientY) { cordx = e.clientX; cordy = e.clientY; } document.getElementById('dvpopupctl').style.left = cordx; document.getElementById('dvpopupctl').style.top = cordy; } } function mouseup(e) { flag1 = 0; } </script> please suggest changes in this code so that i can drag popup anywhere on screen.
  12. i am currently working on asp.net project and I want to hide vertical and horizontal scrollbar on body but i can't use overflow:hidden or any other overflow value. please suggest me any other method which hides scrollbars.
  13. I know one method of finding asp label control under rowdatabound event of gridview. for example following way lbl = e.Row.FindControl("label23") can anybody please suggest any other way of finding label from gridview other than rowdatabound event.
  14. can someone tell me how do I open selected table in another datagridview ? Please help me to solve it.thanks Dim con As SqlCeConnection = New SqlCeConnection("Data Source=|DataDirectory|\Northwind.sdf;Password=***;Persist Security Info=True") Dim Query2 As String = " Select * from INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'TABLE'" Dim DA As SqlCeDataAdapter, Ds As New DataSet, Dtb As New System.Data.DataTable con.Open() DA = New SqlCeDataAdapter(Query2, con) DA.Fill(Ds) con.Close() Dtb = Ds.Tables(0) DataGridView1.DataSource = Dtb
  15. Hi, I'm newbie & just have self-learning a few weeks ago...I've tried to understand how to implement my idea into asp.net vb programming & javascript. I've done all parts except the keystroke part.I would like to calculate the keyhold time of a keypress in ms & also the inter-key latency time between 2 keys. The idea is as below:key 'A' is pressed (keydown) - record keyhold timekey 'A' is depressed (keyup) - record keyhold timekey 'A' is pressed & key 'B' is depressed - record inter-key latency time And also, I need ideas how to put my keystroke data into database. Should I record the key character also??Example: A.down.time || A.up.time || A.B.timeWhat do you think is the simplest way to do as I'm a beginner... Tq. . . v()//
  16. Hi there, I'm new on ASP.NET and have the following problem: I get some data from a MS SQL-Server using a stored procedure. To display the data I'm using <ul>, <li> in a Repeater, because I have to do some optical customization. Now I want to call a sub from the Code Behind file, by clicking on a List Item. Right now the ClickEvent should just cause a Console output, that the Item was clicked.But I'm getting an error, saying the sub is undefined. Here is the code: <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> <ItemTemplate> <li runat="server" onclick="selectItem" data-icon="false"><a href="index.aspx"><%#Eval("Employee")%></a></li> </ItemTemplate> </asp:Repeater> Public Sub selectItem(ByVal sender As Object, ByVal e As System.EventArgs) Console.WriteLine("Clicked") End Sub Thanks for your help
  17. I am new to vb.net .I would like to know how do i insert text box value into combobox selected table ?i can load tables names in combobox but how do i insert into combobox selected table?Thanks in advance Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As EventArgs) Handles MyBase.Load con.Open() Me.ComboBox1.DisplayMember = "TABLE_NAME" Me.ComboBox1.ValueMember = "TABLE_NAME" Me.ComboBox1.DataSource = Me.con.GetSchema("TABLES", New String() {Nothing, Nothing, Nothing, "TABLE"}) con.Close() End SubPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\testdb2.accdb") Dim CmdStr As String = "insert into table1 (a,b,c) values ('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "')" con.Open() Dim cmd As OleDbCommand = New OleDbCommand(CmdStr, con) cmd.ExecuteNonQuery() con.Close() MsgBox("Done") End Sub
  18. Hi guys,I want to create a vb.net application with a login.I want that the login verify the username and password with a table witch contains all usernames and passwords of all members and if the login found a correspondence with the table, I want that the login connect the user at the application.In the next form, I want that the application show some 'informations' like Name, E-mail, ... for the user that is logged in.I have try a lot of code, but none was working correctly.What can I do for make this 'simple' application? Best regards,Francesco